AnsweredAssumed Answered

MPC55XX Codewarrior Linker symbols cant be accessed...Stack paint

Question asked by mechalec on Nov 1, 2013
Latest reply on Nov 6, 2013 by Pascal Irrle

Hi all,

 

This is my first post, so I hope it is clear and concise but also in the correct section.

 

I am doing some development on a MPC5534, using Freescales Codewarrior compiler.

 

I am trying to implement a stack paint algorithm, so that I can determine my stack usage at runtime.

 

My problem lies in the fact that I cannot access the linker generated symbols that are present in the ".lcf".

 

The compiler/linker error:

C:/Freescale/CW MCU v10.4/MCU/PA_Tools/Command_Line_Tools/mwldeppc|Linker|Error

>Small data relocation (109) in function 'vStackInit'

>in referencing file 'stack_c.obj'

>requires that symbol '_stack_addr'

>in symbol definition file 'linker generated symbol'

 

The function below is a simplification of my implementation so that you can get the "idea" of what I am doing.

There is no need to correct the algorithm (Yes, I know it is corrupting any existing values on the stack), but any help

as to the  syntax required to access the symbol "_stack_addr" would be greatly appreciated.

 

 

#define STACK_VALUE 0x55AA55AAul

 

void vStackInit( void );

extern uint32_t _stack_addr;

 

void vStackInit( void )

{

  unsigned int u32IntIndex = 0u;

  unsigned int *pu32Index = (unsigned int *)(_stack_addr);

 

  for(u32IntIndex = 0ul; u32IntIndex < 0x8000ul; u32IntIndex++ ) {

  pu32Index[u32IntIndex] = STACK_VALUE;

  }

}

 

Any help would be greatly appreciated.

Thanks

Outcomes