4299 views|2 replies

3

Posts

0

Resources
The OP
 

In a bare metal environment, how to move the startup code in the external memory EMMC to the SRAM inside the SOC for execution? ? ? ? [Copy link]

As the title says, move the boot code (BootLoader two-stage or three-stage) to the inside of the SOC, do not use assembly language, only use C language to implement it, how to execute the moved code in the bare metal environment? ? ?
This post is from ARM Technology

Latest reply

This post was last edited by le062 on 2018-6-12 17:02 Take the cortex-m series microcontroller as an example: First copy the code, assuming that the vector table location of the code in sram is pkt->store_addr, and use the following code to jump // jump to FIRMWARE_AREA_CODE_ADDR uint32_t (*app_main)(void)= (uint32_t(*)(void))(*(uint32_t *)(pkt->store_addr + 4)); uint32_t *sp = (uint32_t *)(pkt->store_addr); __set_MSP(*sp); app_main(); 复制代码Note: The code itself should be compiled with the placement address in sram as the code address. If the placement address is different from the address specified when the code is compiled, some instructions will fail, such as long jumps   Details Published on 2018-6-12 16:58
 

750

Posts

3

Resources
2
 
This post was last edited by le062 on 2018-6-12 17:02 Take the cortex-m series microcontroller as an example: First copy the code, assuming that the vector table location of the code in sram is pkt->store_addr, and use the following code to jump
  1. // jump to FIRMWARE_AREA_CODE_ADDR uint32_t (*app_main)(void)= (uint32_t(*)(void))(*(uint32_t *)(pkt->store_addr + 4)); uint32_t *sp = (uint32_t *)(pkt->store_addr); __set_MSP(*sp); app_main();
复制代码
Note: The code itself should be compiled with the placement address in sram as the code address. If the placement address is different from the address specified when the code is compiled, some instructions will fail, such as long jumps
This post is from ARM Technology
 
Personal signature

要666

 
 

3

Posts

0

Resources
3
 
le062 posted on 2018-6-12 16:58 Take the cortex-m series microcontroller as an example: First copy the code, assuming that the vector table location of the code in sram is pkt->store_addr, use the following code...
Thank you for your reply! ! ! The function pointer uses the pointer plus offset method to jump the pointer to the address head moved to SRAM for operation. I would like to ask *SP = = (uint32_t *)(pkt->store_addr); __set_MSP(*sp); Does it point the stack pointer to the front of the startup file? ? ? ?
This post is from ARM Technology
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list