Hello,
I want to jump from code in flash to code in RAM.
I have changed the Linker Comannd file,so that i have two code segments,
one in Flash and one in RAM:
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000001E0
m_text (RX) : ORIGIN = 0x00000800, LENGTH = 0x00080000-0x00000800
m_text2 (RWX) : ORIGIN = 0x1FFF0000, LENGTH = 0x00001000
m_data (RW) : ORIGIN = 0x1FFF1000, LENGTH = 0x00020000-0x00001000
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}
.....
with the Inline assembler I want to set the pc to 1FFF0000.
First I saved the pc in r14(link register).
asm{
MOV r14, pc
// MOV pc 0x1FFF0000 ??????? I Want to jump to binary code in flash which starts ai address 0x1FFF0000
}
Does someone know how I can jump from a address which is lower than 0x80000 to address 0x1FFF0000 ?
Thanks
Thomas
已解决! 转到解答。
Hi Thomas,
one example of initializing and running code in RAM is:
bsp_twrk60n512_pe -> twrk60n512 BSP Files -> init_hw.c -> function: pll_init()
(directory ...\Freescale\Freescale MQX 3.7\mqx\source\bsp\twrk60n512)
fcn_thumb_flag = (uint_32)set_sys_dividers & 0x01;
fcn_rom_addr = (uint_32)set_sys_dividers & ~(uint_32)0x01;
fcn_ram_addr = (uint_32)fcn_ram_copy | (fcn_rom_addr & 0x02);
...
Does your linker generate the code which copies/initializes the RAM code?
~Mark
Hello Mark,
thank you for the answer.
I have a bare metal project. I have one code section in Flash memory which is (RX).
In the program i made binary code which I load in RAM (at adress 0x1FFF0000) with memcpy.
The code section in RAM is RWX. After the code section in RAM I have a data section (RW).
After that I will run the binary code. For that I only need an assembler instruction which set
the programcounter to 0x1FFF0000.
My project is a console (LCD-Display with touchscreen) on which the user can write assembler code.
The program converts the assembler code in binary code and copys the binary code at adress 0x1FFF0000.
After that, when the user wants to run his code, the program counter must set to 0x1fff000.
I cant set the pc to 0x1fff0000.
Thanks
Thomas