// __main 会调用main,用户写的main一般不会退出.所以 __main 一般不会退出
You can customize execution initialization by defining your own __main that branches to __rt_entry .
The entry point of a program is at __main in the C library where library code:1. Copies non-root (RO and RW) execution regions from their load addresses to their execution
addresses. Also,if any data sections are compressed, they are decompressed from the load address to
the execution address.2. Zeroes ZI regions.3. Branches to __rt_entry .-----------------翻译
程序的入口点位于C库中的_main,流程为
1. 将 non-root (RO and RW) execution regions 从 加载地址 拷贝到 执行地址.如果data sections被压缩,则将它们从加载地址解压缩到执行地址。//具体实现在(InRoot$$Sections) // 其实 RO(RO-data) 的 加载地址 和 执行地址是一样的.都在0x08000000(主Flash上)// RW(RW-data) 加载地址在 0x08000000 + sizeof(RO-data),执行地址在0x20000000(SRAM1)// ZI(ZI-data) 加载地址在 0x08000000 + sizeof(RO-data),执行地址在0x20000000(SRAM1) // 其实这一段并没有加载,因为加载了也要清0,所以干脆留空.只记录 ZI-data 执行地址的开始地址和结束地址2. 将ZI regions清03. 跳转到__rt_entry