This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to relocate tables from RAM to Flash memory

I am programming the STM32fM4 Discovery board with a Cortex M4F ARM CPU.
I have two large tables, which, after the initialization, are just read-only.
I would like to place them in Flash memory, to free some RAM.

I tried this :

float sintab[8192]  __attribute__((at(0x08010000)));
float costab[8192]  __attribute__((at(0x08018000)));

but the linker complains with this error message :

Error: L6985E: Unable to automatically place AT section main.o(.ARM.__AT_0x08010000) with required base address 0x08010000.
Please manually place in the scatter file using the --no_autoat option.


I am not particularly expert of this compiler/linker, so the above message is not much clear to me. Could please somebody explains how to accomplish what I want ? I don't know what a scatter file is, nor how to code one to relocate in Flash memory my two tables.

Thanks

Parents
  • That's puzzling. Are you saying that you are going to initialize them at run time?

    Thanks for the answer. Yes, they are initialized at run time, as the contents depend on some conditions. So cannot fill them at compile time. Is there any way to have them allocated in Flash memory, where they will be written just once, and then only read ?

    Thanks.

Reply
  • That's puzzling. Are you saying that you are going to initialize them at run time?

    Thanks for the answer. Yes, they are initialized at run time, as the contents depend on some conditions. So cannot fill them at compile time. Is there any way to have them allocated in Flash memory, where they will be written just once, and then only read ?

    Thanks.

Children