HI all,
i managed to get this memory free, it seems that there were some remains of RTCS when porting from K60 to K20. Now i have another problem.
Internal RAM (128 kB) on our K20 MCU is organized in two parts: SRAM_L and SRAM_H. Each part has size 64 kB. There is a boundary address betweeh those two parts at 0x20000000. This memory boundary shouldn't be crossed in single instruction.
I need to allocate 64 kB of RAM in our application. This is exactly half of our RAM or exactly one part if it. Even though i have plenty of RAM free now (more than 117 kB) i cannot allocate 64 kB of RAM from address 0x20000000 on (i get out of memory error). I took a look into linker script and noticed, that there is MQX kernel data and MQX heap allocated at:
MEMORY
{
vectorrom (RX): ORIGIN = 0x00000000, LENGTH = 0x00000400
cfmprotrom (R): ORIGIN = 0x00000400, LENGTH = 0x00000020
rom (RX): ORIGIN = 0x00000420, LENGTH = 0x0007FBE0 /* Code + Const data */
ram (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00020000 /* SRAM - RW data */
/* kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap) */
end_of_kd (RW): ORIGIN = 0x2000FFF0, LENGTH = 0x00000000
/* Boot stack reused by MQX Kernel data */
bstack (RW): ORIGIN = 0x2000FA00, LENGTH = 0x00000200 /* Boot stack */
end_bstack (RW): ORIGIN = 0x2000FC00, LENGTH = 0x00000000 /* Boot stack end address requires 4B alignment */
}
So moved addresses of MQX kernel data + MQX heap and boot stack to the address space of SRAM_L that i could use SRAM_H for my application.
MEMORY
{
vectorrom (RX): ORIGIN = 0x00000000, LENGTH = 0x00000400
cfmprotrom (R): ORIGIN = 0x00000400, LENGTH = 0x00000020
rom (RX): ORIGIN = 0x00000420, LENGTH = 0x0007FBE0 /* Code + Const data */
//ram (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00020000 /* SRAM - RW data */
ram (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00020000 /* SRAM - RW data */
/* kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap) */
//end_of_kd (RW): ORIGIN = 0x2000FFF0, LENGTH = 0x00000000
end_of_kd (RW): ORIGIN = 0x1FFFFFF0, LENGTH = 0x00000000
/* Boot stack reused by MQX Kernel data */
//bstack (RW): ORIGIN = 0x2000FA00, LENGTH = 0x00000200 /* Boot stack */
//end_bstack (RW): ORIGIN = 0x2000FC00, LENGTH = 0x00000000 /* Boot stack end address requires 4B alignment */
bstack (RW): ORIGIN = 0x1FFFFA00, LENGTH = 0x00000200 /* Boot stack */
end_bstack (RW): ORIGIN = 0x1FFFFC00, LENGTH = 0x00000000 /* Boot stack end address requires 4B alignment */
}
Problem is that i "see" only 64 kB of RAM (only SRAM_L) if i check memory pool with the debuger tool in CodeWarrior. I get an out of memory error if i try to allocate memory in this case. I also tried do allocate another memory pool with _mem_create_pool command but my application ends with error in "dispatch.s".
Is there a way to modify linker script that everything is being kept in SRAM_L and i have complete SRAM_H avalilable for my application data?