0

Hello,

I am working on converting some code over to the KPIT RX compiler on the RX210. It is a 512K ROM and 64K RAM model. I am using Eclipse, Segger J-Link and rx-elf-gdb on Linux to debug.

I have some code that looks like this:

<startup code before>

const SomeStruct_t *pointerToStruct = FunctionCall();

“FunctionCall” will return a pointer to a structure in ROM.

When viewing on GDB, I can see that “pointerToStruct”is at memory location 0xFFFFFFF8, which is ROM. This means the function call can’t change the value of the pointer and instead returns a pointer to whatever happens to be in memory location 0xFFFFFFF8. That happens to be the fixed vector table, so its pretty much garbage data.

I can force it into RAM by doing:

const SomeStruct_t *pointerToStruct __attribute__((section(“.data”)));

pointerToStruct = FunctionCall();

That then returns the pointer to the correct section of data. However, that is unacceptable, and would force me to stay with my current compiler. It is more for testing that the value is not garbage in ROM.

ISP and USP are both set to 0xFFFF.

I used the samples in the toolchain to help create the startup code and linker file. Do you have an suggestions on what could possibly be wrong? I’m guessing that I am missing something in the linker file or a compile option.

Thanks for the help!

Open Source Tools Support 回答済