How to access far.rodata when memory model is medium

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to access far.rodata when memory model is medium

Howard0Su
I am building btstack with msp430-gcc 4.7. I got the following error when access a data in far.rodata region.
btstack/chipset-cc256x/bt_control_cc256x.c:194:(.any.text.bt_control_cc256x_next_cmd+0x16): relocation truncated to fit: R_MSP430_16_BYTE against symbol `cc256x_init_script' defined in .far.rodata.cc256x_init_script section in objs/btstack/chipset-cc256x/bt_control_cc256x.o

the code looks like this:
#if defined(__GNUC__) && (__MSP430X__ > 0)
#define __data20 __attribute__((__far__))
#endif
const uint8_t cc256x_init_script[] __data20 = {............};

the access code is:
    for(int i = 0; i < 3; i++)
      hci_cmd_buffer[i]= cc256x_init_script[init_script_offset + i];

How can I work around this? This is a big project I don't want to switch to huge memory model.

-Howard