AnsweredAssumed Answered

Relocation without __declspec keyword

Question asked by markusa on Mar 17, 2014
Latest reply on Apr 27, 2018 by stanish

Hello,

I am trying to program a bootloader-application combination at MPC5643L using CodeWarrior 10.5.

Bootloader and application communicate by a shared structure therefore the pointer to this structure must be located to a fixed address.

The access to the structure members via this pointer is located in various other files which are being shared with other projects so it's difficult to change the declaration of the variable.

So here's my question:

Is it possible to locate a variable (in RAM) on a defined address without using the __declspec keyword ?

 

I tried this:

volatile tTableStruct TheTableStruct;  #pragma push #pragma section RW ".ptrTableStruct" volatile tTableStruct *TableStruct = &TheTableStruct; #pragma pop 

 

It compiles but the section ".ptrTableStruct" is empty and the pointer "TableStruct" is located somewhere in RAM.

 

Then I tried this:

volatile tTableStruct TheTableStruct;  #pragma push #pragma section data_type ".ptrTableStruct" volatile tTableStruct *TableStruct = &TheTableStruct; #pragma pop 

This leads to an linker error:

sections used for data must have an uninitialized data section in line #1

 

Thank you,

Markus

Outcomes