Hi everyone,
I'm looking for memory map header file where I can change the RAMStart and RAMend addresses.
I'm currently using CodeWarrior for writing to the 9S12C32 (via Technological Art's Esduino board rev. 1).
The start and end should be: $3800 to $3FFF. However, everytime I begin a new project, the default values are
$0800 to $0FFF.
When I start a new project in assembly, I can access the "mc9s12c32.inc" and change the RAMStart and RAMEnd.
However, in a new project in C, I can seem to find a similar header file to change it.
Thank you in advance.
已解决! 转到解答。
To map the RAM differently you need to do the following:
In the PRM file change the addresses. For example, this maps RAM from 0x2000 to 0x3FFF, with reserved space for the stack.
SEGMENTS STACK_RAM = READ_WRITE 0x2000 TO 0x24FF; RAM = READ_WRITE 0x2500 TO 0x3FFF; END PLACEMENT .stack INTO STACK_RAM; END STACKSIZE 0x500
Note: the stack should be placed below the rest of the RAM in the memory map. That way, a stack overflow will write to illegal addresses yielding an error, instead of silently trashing your whole RAM.
Whether you write in assembler or C, you will then have to write to the RAM mapping register INITRM (the CW debugger can handle such memory mapping writes in runtime). This is best done directly from the reset vector. Example:
void interrupt_reset(void) { #pragma MESSAGE DISABLE C12053 asm LDS #$2500; /* set stack */ INITRM = 0x21; /* map RAM */ asm CALL main; }
To map the RAM differently you need to do the following:
In the PRM file change the addresses. For example, this maps RAM from 0x2000 to 0x3FFF, with reserved space for the stack.
SEGMENTS STACK_RAM = READ_WRITE 0x2000 TO 0x24FF; RAM = READ_WRITE 0x2500 TO 0x3FFF; END PLACEMENT .stack INTO STACK_RAM; END STACKSIZE 0x500
Note: the stack should be placed below the rest of the RAM in the memory map. That way, a stack overflow will write to illegal addresses yielding an error, instead of silently trashing your whole RAM.
Whether you write in assembler or C, you will then have to write to the RAM mapping register INITRM (the CW debugger can handle such memory mapping writes in runtime). This is best done directly from the reset vector. Example:
void interrupt_reset(void) { #pragma MESSAGE DISABLE C12053 asm LDS #$2500; /* set stack */ INITRM = 0x21; /* map RAM */ asm CALL main; }