Mapping variable to user-defined section

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mapping variable to user-defined section

Jump to solution
1,444 Views
PeterFromSweden
Contributor III

Hi

I cannot get any way to map a variable to a specific section to work.

 

Memory section is created by processor expert, here it is called mysection

 

From processorexpert.lcf

MEMORY {  interrupts  (RX) : ORIGIN = 0x1FFF0000, LENGTH = 0x000001E0  code        (RX) : ORIGIN = 0x1FFF01E0, LENGTH = 0x00015220  data14000000 (RW) : ORIGIN = 0x14000000, LENGTH = 0x00001000  data        (RW) : ORIGIN = 0x20005400, LENGTH = 0x00006C00  mysection   (RW) : ORIGIN = 0x2000C000, LENGTH = 0x00004000  cfmprotrom  (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010}

 Here are some traces on what I have tried to map a variable to "mysection"

#pragma define_section MYSECTION ".bss"  far_absolute RW//#pragma section MYSECTION begin//uint16_t adcIn[8192] __attribute__ ((align (8));uint16_t adcIn[8192] __attribute__ ((section ("MYSECTION")));//__declspec(MYSECTION) uint16_t adcIn[8192];//uint16_t adcIn[8192];//#pragma section MYSECTION end

 The compilation/linking is OK, but the variable "adcIn" maps to section "data" no matter what.

 

Any ideas?

0 Kudos
Reply
1 Solution
996 Views
PeterFromSweden
Contributor III
#pragma define_section MYSECTION ".mysection" abs32 RW__declspec(MYSECTION) uint16_t adcIn[8*2*512];/* lcf file  .mysection :  {    __START_MYSECTION = .;    * (.mysection)    __END_MYSECTION = .;    . = ALIGN(0x4);  } > mysection*/

 The above is working, but ProcessorExpert must be configured to not generate linker file due to the manually added code in lcf file.

View solution in original post

0 Kudos
Reply
2 Replies
996 Views
PeterFromSweden
Contributor III

By the way, the following code makes CW10 arm compiler to crash:

#pragma define_section MYSECTION ".sec1" ".sec2" ".sec3" ".sec4" far_absolute RW

 

0 Kudos
Reply
997 Views
PeterFromSweden
Contributor III
#pragma define_section MYSECTION ".mysection" abs32 RW__declspec(MYSECTION) uint16_t adcIn[8*2*512];/* lcf file  .mysection :  {    __START_MYSECTION = .;    * (.mysection)    __END_MYSECTION = .;    . = ALIGN(0x4);  } > mysection*/

 The above is working, but ProcessorExpert must be configured to not generate linker file due to the manually added code in lcf file.

0 Kudos
Reply