Jimmy Nordin

Problems using "pragma sections" with BDM in the OpenTCP project.

Discussion created by Jimmy Nordin on Jun 19, 2006
Latest reply on Jun 20, 2006 by CompilerGuru

Hello!

Hope someone can help me with my pragma problem.

 

Equipment:
I'm running Codewarrior 3.1 on a MC9S12NE64EVB using a "BDM Pod (P&E ICD)" and I use the code from the OpenTCP project.

 

What I want to do:
I would like to allocate a memory block in RAM in order to move and run a function there. Below you can see the necesary lines in my .prm-file for the allocation and my code implementation.

 

****************************************************************************************
NAMES
END
SEGMENTS 
 
  RAM_FBURN  = READ_ONLY  0x2180 TO 0x24FF;    //Memory allocation
  RAM                = READ_WRITE 0x2500 TO 0x3FFE;   /* BUFMAP = 0 (128 byte) END

PLACEMENT
       FBURN                        INTO  RAM_FBURN;
END
****************************************************************************************
==========================================================
void main(void)
{

      test_function();


#pragma CODE_SEG FBURN
void test_function(){
int a;
char tecken = 'A';
for(a=0;a<5;a++){
 tecken++;
}
 #pragma CODE_SEG DEFAULT
===========================================================
The problem:
When I use the serial monitor interface everything works exactly as I want. :smileyhappy:

 

But as soon as I switch to the BDM pod it's like a one way ticket to hell.

:smileymad:

 

The first problem I encounter while starting the Debugger is (Elf Loader) Error while writing to 2180...2380. Information: No memory at this address.

I believe that the problem is some sort of a "memory offset" problem because when I look in the "Debugging Memory Map"-window it displays that the RAM should be between 0x0000 - 0x1FFF. However if I modify this to start at 0x2000 instead, I'm able to run the code.

 

In the beginning Everything seems to work fine, the function test_function is placed at 0x2180 in the RAM area, but when I'm using the single step the code in the Assembly window seems out of place but the other windows are displayed correctly.

 

I also noticed the following line in the ne64driver.c, I've tried to modify this without any success (I also believe that modifing this file affects the Emac buffer.)

 

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#define RAM_START 0x2000    /**< RAM block starting address */

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

I really hope any of you can help me solve this annoying problem.

 

Thanks in advance!

 

Outcomes