Hi all, I have an existing C-code base that we need to re-use in a new product(DS80C400). I'm running into an issue where uVision is throwing all of the variables into XDATA (thus overflowing and causing an error). Declaring all of the vars as 'far' is not an option since this code base is used on an active existing product. We are looking for minimal "dual compilation" as possible for this code base. Is there any way via the compiler or linker to default variables into HDATA? Thanks.
The memory model selected for your target determines where the default storage area is. By default, a project is configured for a Small memory model in which if the datatype is not defined, it will be stored in the DATA area. Other options include Compact (PDATA) or Large (XDATA). So it sounds like your configured for the large memory model. I've never heard of "HDATA"....but, I think your only option would be to do a bit of conditional compilation. Philip
FYI Philip The address space for XDATA is only 64k. The DS80C400 is an extended 8051 variant that extends the address space for variables to 16MB i.e., HDATA
You will have to add far keywords to your project, I think. Keil doesn't place any objects in HDATA by default, in any memory model. Some others you'll want to declare as const far to have them in HCONST (ROM) For the sake of keeping the code sane and usable by other compilers, you'll want to hide that keyword behind a macro, i.e.
#if __CX51__ # define FAR far #else # define FAR /* nothing */ #endif