Makefile 构建 rtthread 工程2-finsh
在上一文中,已经把 rtthread 内核成功编译通过并跑起来了,下一步就是尝试添加组件,此处以 finsh 为例。
首先修改链接脚本,此处为 STM32F429BITx_FLASH.ld ,主要是为 rtthread 添加所需的段,在 SECTIONS -> .text 修改如下:
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
/* section information for finsh shell */
. = ALIGN(4);
__fsymtab_start = .;
KEEP(*(FSymTab))
__fsymtab_end = .;
. = ALIGN(4);
__vsymtab_start = .;
KEEP(*(VSymTab))
__vsymtab_end = .;
. = ALIGN(4);
/* section information for initial. */
. = ALIGN(4);
__rt_init_start = .;
KEEP(*(SORT(.rti_fn*)))
__rt_init_end = .;
. = ALIGN(4);
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
添加这两个段的目的也是为了实现隐式调用,比如 rtthread 的一些组件初始化函数,比如rtthread 导出到命名行的命令,