|
Re: Please help: Memory allocation problem dealing with sections
The "rom const" directive is in the C18 manual. What it says is that the data that it refers to, (whatever its type - char, int, struct, array...) is not going to change (the const part). Further it says that you want this data to be stored in the program memory (the rom part).
The compiler will look at the directive and allocate the space for the data along with the program in the program memory which is much much bigger than the RAM. The compiler will make sure that the addressing modes in the generated machine code for accessing that data are appropriate for pulling data out of the program space.
Take a look at the .map file with the data declared as "rom const" and again with
the data declared without the "rom const" and see what section and what address the data is being stored at. I think that will help you understand what is going on.
|