AnsweredAssumed Answered

Placing variables in my section

Question asked by Marco Fratini on Sep 8, 2010
Latest reply on Sep 9, 2010 by RICK BOURGEOIS

Hi everybody. I'm using M52259DEMOIT and I'm creating a new MQX project. I have CW 7.2 and MQX3.6.

 

I need to place some variables in the section I create in the .lcf file. In my previous project, with no MQX environment, I did it, but now I'm getting some errors. 

 

I create my section (named static_ram) after BSS in .lcf file (I copied the .lcf in my project folder):

 

 

MEMORY{## intflash    (RX): ORIGIN = 0x00000000, LENGTH = 0x00080000## sram        (RW): ORIGIN = 0x20000000, LENGTH = 0x00010000   vectorrom   (RX): ORIGIN = 0x00000000, LENGTH = 0x00000400   cfmprotrom  (RX): ORIGIN = 0x00000400, LENGTH = 0x00000020   rom         (RX): ORIGIN = 0x00000420, LENGTH = 0x0007FBE0  # Code + Const data    ram         (RW): ORIGIN = 0x20000000, LENGTH = 0x00010000  # SRAM - RW data   # kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap)   end_of_kd   (RW): ORIGIN = 0x2000FFF0, LENGTH = 0x00000000      # Boot stack reused by MQX Kernel data   bstack      (RW): ORIGIN = 0x2000FA00, LENGTH = 0x00000200  # Boot stack   end_bstack  (RW): ORIGIN = 0x2000FBFF, LENGTH = 0x00000000}[...].main_application_bss :   {      __START_SBSS = .;      *(.sbss)      *(SCOMMON)      __END_SBSS = .;      __START_BSS = .;      *(.bss)      *(COMMON)      __END_BSS = .;   } >> ram.static_ram :   {      __START_MYRAM = .;      main.c(.my_variables)      __END_MYRAM = .;   } >> ram[...]

and after making the project I check my .xmap file that contains the new section created:

 

 

 

 

[...]# .main_application_bss#>20000680          __START_SBSS (linker command file)#>20000680          __END_SBSS (linker command file)#>20000680          __START_BSS (linker command file)  20000680 00000004 .bss    menu (main.c)  20000684 00000006 .bss    rtc_time (main.c)  2000068C 00000004 .bss    port_tc_file (main.c)  20000690 00000004 .bss    _mqx_system_stack (mqx_regabi_d.a mqx.o          )  20000694 00000004 .bss    driver_bundle (m52259demo_regabi_d.a adc_mcf522xx.o )  20000698 00000004 .bss    adc_channels_used (m52259demo_regabi_d.a adc_mcf522xx.o )  2000069C 00000004 .bss    old_isr_adc1_param (m52259demo_regabi_d.a adc_mcf522xx.o )  200006A0 00000004 .bss    old_isr_adc1 (m52259demo_regabi_d.a adc_mcf522xx.o )  200006A4 00000004 .bss    mcf522xx_adc_ptr (m52259demo_regabi_d.a adc_mcf522xx.o )  200006A8 00000004 .bss    old_isr_timer_param (m52259demo_regabi_d.a adt_pit_mcf522x)  200006AC 00000004 .bss    old_isr_timer (m52259demo_regabi_d.a adt_pit_mcf522x)  200006B0 00000008 .bss    adt_internal (m52259demo_regabi_d.a adt_pit_mcf522x)  200006B8 00000004 .bss    mcf522xx_timer_ptr (m52259demo_regabi_d.a adt_pit_mcf522x)  200006BC 00000004 .bss    first_irq (m52259demo_regabi_d.a io_gpio.o      )  200006C0 00000004 .bss    mcf5225_eport_ptr (m52259demo_regabi_d.a io_gpio_mcf5225)  200006C4 00000004 .bss    mcf5225_gpio_ptr (m52259demo_regabi_d.a io_gpio_mcf5225)#>200006C8          __END_BSS (linker command file)# .static_ram#>200006C8          __START_MYRAM (linker command file)#>200006C8          __END_MYRAM (linker command file)# .kernel_data#>200006D0          ___KERNEL_DATA_START (linker command file)[...]

 

 

 

Now in main.c I define my variable to be stored in that section but I'm in trouble with that. I tried both "__declspec(static_ram)" and "#pragma section static_ram". The first gives the error "Illeal type qualifier(s)" and the seconds gives no error but places my variable in standard bss section.

 

Where am I wrong?

 

Thanks in advance,

Marco

 

Outcomes