Initializing the system
One of the main considerations with application code in ROM is the way in which the application initializes itself and starts executing. If there is an operating system present, this does not cause a problem because the application is entered automatically through the main() function.
No automatic initialization takes place on RESET, so the application entry point must perform some initialization before it can call any C code.
Typically, the initialization code should carry out some or all of the following tasks:
• defining the entry point
• setting up exception vectors
• initializing the memory system
• initializing the stack pointer registers
• initializing any critical I/O devices
• initializing any RAM variables required by the interrupt system
• enabling interrupts
• changing processor mode if necessary
• changing processor state if necessary
• initializing memory required by C
• entering C code.
本文详细介绍了当应用程序代码位于ROM中时,初始化过程的具体步骤。文章指出,在复位时不会自动初始化,因此需要应用程序入口执行一些初始化任务才能调用C代码。这些任务包括设置异常向量、初始化内存系统、配置中断等。
2742

被折叠的 条评论
为什么被折叠?



