MS-RTOS 移植方法
本章将介绍 MS-RTOS 移植到某一款芯片上的方法。
BSP 函数
当移植 MS-RTOS 到某一款芯片上,需要实现一个板级支持包 BSP,BSP 里面主要包括了启动代码、链接脚本、驱动程序和 MS-RTOS 依赖于硬件平台需要实现的一些函数,MS-RTOS 定义了这些函数的接口、功能规范,开发者需要实现这些接口方能使得 MS-RTOS 能够在该芯片上运行起来:
// 机器重启
void ms_bsp_reboot(void);
// 关机
void ms_bsp_shutdown(void);
// 打印一则内核消息
void ms_bsp_printk(const char *buf, ms_size_t len);
// 记录一则 LOG 日志
void ms_bsp_log_write(const char *buf, ms_size_t len);
// 使能指定的中断
ms_err_t ms_bsp_int_enable(ms_irq_t irq);
// 屏蔽指定的中断
ms_err_t ms_bsp_int_disable(ms_irq_t irq);
// 判断指定的中断是否使能
ms_bool_t ms_bsp_int_is_enable(ms_irq_t irq);
// 获得设备名
const char *ms_bsp_device_name(void);
// 获得 CPU 主频
ms_uint32_t ms_bsp_cpu_freq(void);
// 获得时间戳的频率
ms_uint32_t ms_bsp_timestamp_freq(void);
// 获得中断的 trace 描述信息
const char *ms_bsp_int_trace_desc(void);
// 获得 tick-less 模式相关工作参数
void ms_bsp_tick_less_param(ms_tick_t *max_tick, ms_tick_t *min_tick,
ms_uint32_t *timer_cnt_per_tick,
ms_uint32_t *timer_stop_compensation);
// 进入 tick-less CPU 休眠模式
void ms_bsp_tick_less_sleep(ms_tick_t expected_tick, ms_arch_sr_t sr);
// 设置 CPU 运行模式
void ms_bsp_pm_set_run_mode(ms_pm_run_mode_t run_mode);
// 响应电源管理的通知事件
void ms_bsp_pm_notify(ms_pm_sleep_mode_t sleep_mode, ms_pm_event_t event);
//让 CPU 进入指定的休眠模式
void ms_bsp_pm_sleep(ms_pm_sleep_mode_t sleep_mode, ms_arch_sr_t sr);
// 启动低功耗定时器
void ms_bsp_pm_timer_start(ms_tick_t tick);
// 停止低功耗定时器
void ms_bsp_pm_timer_stop(void);
// 获得 CPU 休眠期间低功耗定时器流逝的嘀嗒数
ms_tick_t ms_bsp_pm_timer_elapsed(void);
// 响应健康监控的通知事件
void ms_bsp_hm_notify(ms_pid_t pid, ms_hm_handle_mode_t mode);
// MMU 使能前的处理(一般用于 IO 寄存器重映射)
void ms_bsp_mmu_pre_enable(void);
// MPU 使能前的处理
void ms_bsp_mpu_pre_enable(void);
BSP 函数依赖
BSP 函数并非强制需要全部实现,下表展示了 BSP 相关的函数依赖,用户可以根据实际需要,裁减掉不需要的单元,部分 BSP 函数即可不实现:
函数 | 依赖 |
---|---|
ms_bsp_reboot | 无 |
ms_bsp_shutdown | 无 |
ms_bsp_printk | 无 |
ms_bsp_log_write | 日志系统 |
ms_bsp_int_enable | 中断管理 |
ms_bsp_int_disable | 中断管理 |
ms_bsp_int_is_enable | 中断管理 |
ms_bsp_device_name | Trace |
ms_bsp_cpu_freq | Trace |
ms_bsp_timestamp_freq | Trace |
ms_bsp_int_trace_desc | Trace |
ms_bsp_tick_less_param | Tick-less |
ms_bsp_tick_less_sleep | Tick-less |
ms_bsp_pm_set_run_mode | 电源管理 |
ms_bsp_pm_notify | 电源管理 |
ms_bsp_pm_sleep | 电源管理 |
ms_bsp_pm_timer_start | 电源管理 |
ms_bsp_pm_timer_stop | 电源管理 |
ms_bsp_pm_timer_elapsed | 电源管理 |
ms_bsp_mmu_pre_enable | 带有 MMU 的 CPU |
ms_bsp_mpu_pre_enable | 带有 MPU 的 CPU |
BSP 模板
IoT Studio 的 BSP 工程创建也提供了 BSP 模板,在 BSP 模板创建的 BSP 工程上修改,可加速 BSP 开发,降低门槛,BSP 模板主要由以下几个文件组件:
文件 | 用途 |
---|---|
startup.S | 芯片启动文件,包含了异常向量表 |
bsp_init.c | BSP 初始化文件 |
config.h | BSP 工程配置头文件 |
config.ld | 链接脚本配置文件 |
MS-RTOS.ld | BSP 链接脚本 |
startup.S 芯片启动文件
以下是 ARMv7M 的 startup.S
文件,读者需要修改下面的 XXX_IRQHandler
为实际的 IRQ 处理并添加更多的 IRQ 处理,初始化过程首先会调用 CMSIS 系统的初始化函数 SystemInit
,然后进入 Handler 模式,拷贝 .data
段数据到 RAM,并清零 .bss
段,最后调用 BSP 初始化函数 bsp_init
。
/*********************************************************************************************************
**
** 北京翼辉信息技术有限公司
**
** 微型安全实时操作系统
**
** MS-RTOS(TM)
**
** Copyright All Rights Reserved
**
**--------------文件信息--------------------------------------------------------------------------------
**
** 文 件 名: startup.S
**
** 创 建 人: Jiao.jinxing
**
** 文件创建日期: 2020 年 04 月 07 日
**
** 描 述: xxx 芯片启动代码
*********************************************************************************************************/
/*********************************************************************************************************
Configuration
*********************************************************************************************************/
#include "ms_arch_cfg.h"
#include "../config.h"
#undef __PERFORMANCE_IMPLEMENTATION
#define __ARMV7M_SCB_BASE 0xe000ed00
#define __ARMV7M_SCB_VTOR 0x8
#define __ARMV7M_SCB_DCCMVAC 0x268
#define __ARMV7M_SCB_ICIMVAU 0x258
#define __ARMV7M_CACHE_LINE_SIZE 32
.syntax unified
.arch armv7-m
/*********************************************************************************************************
Exception vector table
*********************************************************************************************************/
.section .isr_vector, "a"
.align 2
.globl __isr_vector
__isr_vector:
.word __ms_boot_stack_start__ /* Top of Stack */
.word Reset_Handler /* Reset Handler */
.word NMI_Handler /* NMI Handler */
.word HardFault_Handler /* Hard Fault Handler */
.word MemManage_Handler /* MPU Fault Handler */
.word BusFault_Handler /* Bus Fault Handler */
.word UsageFault_Handler /* Usage Fault Handler */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word 0 /* Reserved */
.word SVC_Handler /* SVCall Handler */
.word DebugMon_Handler /* Reserved */
.word 0 /* Reserved */
.word PendSV_Handler /* PendSV Handler */
.word SysTick_Handler /* SysTick Handler */
/* External Interrupts */
.word XXX_IRQHandler /* XXX Handler */
.size __isr_vector, . - __isr_vector
/*********************************************************************************************************
mov32 - loads a 32-bit value into a register without a data access
*********************************************************************************************************/
.macro mov32 rd, imm32
movw \rd, #:lower16:\imm32
.if \imm32 & 0xffff0000
movt \rd, #:upper16:\imm32
.endif
.endm
/*********************************************************************************************************
Reset Handler
*********************************************************************************************************/
.text
.thumb
.thumb_func
.align 2
.globl Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
/*********************************************************************************************************
Switch to Handler_Mode
*********************************************************************************************************/
#if MS_CFG_ARCH_MPU_EN > 0
/* Copy __isr_vector to __ms_boot_stack_end__ */
ldr r1, =__ms_boot_stack_end__ /* Allocate a temporary vector */
ldr r0, =__isr_vector
ldr r2, [r0, #0 * 4]
str r2, [r1, #0 * 4]
ldr r2, [r0, #1 * 4]
str r2, [r1, #1 * 4]
ldr r2, [r0, #2 * 4]
str r2, [r1, #2 * 4]
ldr r2, [r0, #3 * 4]
str r2, [r1, #3 * 4]
ldr r2, [r0, #4 * 4]
str r2, [r1, #4 * 4]
ldr r2, [r0, #5 * 4]
str r2, [r1, #5 * 4]
ldr r2, [r0, #6 * 4]
str r2, [r1, #6 * 4]
ldr r2, [r0, #7 * 4]
str r2, [r1, #7 * 4]
ldr r2, [r0, #8 * 4]
str r2, [r1, #8 * 4]
ldr r2, [r0, #9 * 4]
str r2, [r1, #9 * 4]
ldr r2, [r0, #10 * 4]
str r2, [r1, #10 * 4]
/* SVC handle jump to 0f */
ldr r2, =0f
orr r2, #1 /* Set thumb bit */
str r2, [r1, #11 * 4]
ldr r2, [r0, #12 * 4]
str r2, [r1, #12 * 4]
ldr r2, [r0, #13 * 4]
str r2, [r1, #13 * 4]
ldr r2, [r0, #14 * 4]
str r2, [r1, #14 * 4]
ldr r2, [r0, #15 * 4]
str r2, [r1, #15 * 4]
dsb
isb
mov32 r0, __ARMV7M_SCB_BASE /* SCB_BASE */
str r1, [r0, #__ARMV7M_SCB_VTOR] /* Write VTOR */
dsb
isb
svc #0
0:
/*********************************************************************************************************
Restore the early vector
*********************************************************************************************************/
ldr r1, =__vector_start__
str r1, [r0, #__ARMV7M_SCB_VTOR] /* Restore VTOR */
dsb /* [1] */
#endif /* MS_CFG_ARCH_MPU_EN > 0 */
/*********************************************************************************************************
Loop to copy data from read only memory to RAM. The ranges
of copy from/to are specified by following symbols evaluated in
linker script.
__etext: End of code section, i.e., begin of data sections to copy from.
__data_start__/__data_end__: RAM address range that data should be
__noncachedata_start__/__noncachedata_end__ : none cachable region
__ram_function_start__/__ram_function_end__ : ramfunction region
copied to. Both must be aligned to 4 bytes boundary.
*********************************************************************************************************/
ldr r1, =_sidata
ldr r2, =_sdata
ldr r3, =_edata
/*********************************************************************************************************
Avoid clear zero .ms_segger_rtt section if using bootloader
*********************************************************************************************************/
#if BSP_CFG_USE_BOOTLOADER > 0
ldr r4, =__ms_segger_rtt_start__
ldr r5, =__ms_segger_rtt_end__
sub r4, r5, r4
add r1, r1, r4
add r2, r2, r4
#endif
/*********************************************************************************************************
Here are two copies of loop implementations. First one favors performance
and the second one favors code size. Default uses the second one.
Define macro "__PERFORMANCE_IMPLEMENTATION" in project to use the first one
*********************************************************************************************************/
#ifdef __PERFORMANCE_IMPLEMENTATION
subs r3, r2
ble .LC1
.LC0:
subs r3, #4
ldr r0, [r1, r3]
str r0, [r2, r3]
bgt .LC0
.LC1:
#else /* code size implemenation */
.LC0:
cmp r2, r3
ittt lt
ldrlt r0, [r1], #4
strlt r0, [r2], #4
blt .LC0
#endif
/*********************************************************************************************************
This part of work usually is done in C library startup code. Otherwise,
define this macro to enable it in this startup.
Loop to zero out BSS section, which uses following symbols
in linker script:
__bss_start__: start of BSS section. Must align to 4
__bss_end__: end of BSS section. Must align to 4
*********************************************************************************************************/
ldr r1, =__bss_start__
ldr r2, =__bss_end__
movs r0, 0
.LC5:
cmp r1, r2
itt lt
strlt r0, [r1], #4
blt .LC5
/*********************************************************************************************************
CMSIS system initialize(Will initialize VTOR)
*********************************************************************************************************/
#if BSP_CFG_USE_BOOTLOADER == 0
ldr r0, =SystemInit
blx r0
#endif
/*********************************************************************************************************
Call bsp_init
*********************************************************************************************************/
ldr r0,=bsp_init
blx r0
.size Reset_Handler, . - Reset_Handler
/*********************************************************************************************************
Macro to define default handlers.
Default handler will be weak symbol and just dead loops.
They can be overwritten by other handlers
*********************************************************************************************************/
.macro def_irq_handler handler_name
.align 1
.thumb_func
.weak \handler_name
.type \handler_name, %function
\handler_name:
b \handler_name
.size \handler_name, . - \handler_name
.endm
def_irq_handler XXX_IRQHandler
.end
/*********************************************************************************************************
END
*********************************************************************************************************/
bsp_init.c BSP 初始化文件
下面是 bsp_init.c
文件模板:
/*********************************************************************************************************
**
** 北京翼辉信息技术有限公司
**
** 微型安全实时操作系统
**
** MS-RTOS(TM)
**
** Copyright All Rights Reserved
**
**--------------文件信息--------------------------------------------------------------------------------
**
** 文 件 名: bsp_init.c
**
** 创 建 人: Jiao.jinxing
**
** 文件创建日期: 2020 年 04 月 07 日
**
** 描 述: BSP 初始化
*********************************************************************************************************/
#include "../config.h"
#include "ms_config.h"
#include "ms_rtos.h"
#include "driver/ms_drv_trace.h"
/**
* @brief CMSIS system initialize.
*
* @return N/A
*/
MS_WEAK void SystemInit(void)
{
}
/**
* @brief This function provides minimum delay (in milliseconds) based
* on variable incremented.
*
* @param[in] delay Specifies the delay time length, in milliseconds.
*
* @return N/A
*/
void HAL_Delay(uint32_t delay)
{
ms_thread_sleep_ms(delay);
}
/**
* @brief Provides a tick value in millisecond.
*
* @retval Tick value
*/
uint32_t HAL_GetTick(void)
{
return ms_time_get_ms();
}
/**
* @brief Initial the bsp unit.
*
* @return Error number
*/
ms_err_t ms_bsp_unit_init(void)
{
return MS_ERR_NONE;
}
/**
* @brief Kernel info print.
*
* @param[in] buf Pointer to content which need to be print
* @param[in] len The length of buffer
*
* @return N/A
*/
void ms_bsp_printk(const char *buf, ms_size_t len)
{
}
/**
* @brief Reboot.
*
* @return N/A
*/
void ms_bsp_reboot(void)
{
while (MS_TRUE);
}
/**
* @brief Shutdown.
*
* @return N/A
*/
void ms_bsp_shutdown(void)
{
while (MS_TRUE);
}
/**
* @brief Get device name.
*
* @return Device name
*/
const char *ms_bsp_device_name(void)
{
return "Cortex-M4";
}
/**
* @brief Get interrupt trace description.
*
* @return Interrupt trace description
*/
const char *ms_bsp_int_trace_desc(void)
{
return "I#15=SysTick";
}
/**
* @brief Get system Frequency.
*
* @return System Frequency
*/
ms_uint32_t ms_bsp_cpu_freq(void)
{
return 0U;
}
/**
* @brief Get the frequency of the timestamp.
*
* @return The frequency of the timestamp
*/
ms_uint32_t ms_bsp_timestamp_freq(void)
{
return 0U;
}
#if MS_CFG_KERN_TICK_LESS_EN > 0U
/**
* @brief Get tick less parameters.
*
* @param[out] max_tick Max time in tick of hardware timer
* @param[out] min_tick Min time in tick need enter tick less mode
* @param[out] timer_cnt_per_tick Hardware timer count per tick
* @param[out] timer_stop_compensation Hardware timer count compensation when timer stoped
*
* @return N/A
*/
void ms_bsp_tick_less_param(ms_tick_t *max_tick, ms_tick_t *min_tick, ms_uint32_t *timer_cnt_per_tick, ms_uint32_t *timer_stop_compensation)
{
}
#endif
/**
* @brief Cortex-M System Tick handler.
*
* @return N/A
*/
void SysTick_Handler(void)
{
(void)ms_int_enter();
(void)ms_kern_tick(1U);
(void)ms_int_exit();
}
#if MS_CFG_SHELL_MODULE_EN > 0
/**
* @brief Shell thread.
*
* @param[in] arg Shell thread argument
*
* @return N/A
*/
static void shell_thread(void *arg)
{
extern unsigned long __ms_shell_cmd_start__;
extern unsigned long __ms_shell_cmd_end__;
ms_shell_io_t bsp_shell_io = {
(ms_shell_cmd_t *)&__ms_shell_cmd_start__,
(ms_shell_cmd_t *)&__ms_shell_cmd_end__ - (ms_shell_cmd_t *)&__ms_shell_cmd_start__,
ms_trace_getc,
ms_trace_putc,
ms_trace_write,
ms_trace_printf,
};
while (MS_TRUE) {
ms_shell_enter(&bsp_shell_io);
}
}
#endif
/**
* @brief Boot thread.
*
* @param[in] arg Boot thread argument
*
* @return N/A
*/
static void boot_thread(void *arg)
{
}
/**
* @brief BSP application initialize.
*
* @return N/A
*/
static void ms_app_init(void)
{
#if MS_CFG_SHELL_MODULE_EN > 0
ms_thread_create("t_shell",
shell_thread,
MS_NULL,
2048U,
MS_CFG_KERN_LOWEST_PRIO - 1U,
70U,
MS_THREAD_OPT_SUPER | MS_THREAD_OPT_REENT_EN,
MS_NULL);
#endif
ms_thread_create("t_boot",
boot_thread,
MS_NULL,
2048U,
4U,
70U,
MS_THREAD_OPT_SUPER | MS_THREAD_OPT_REENT_EN,
MS_NULL);
}
/**
* @brief BSP initialize.
*
* @return N/A
*/
void bsp_init(void)
{
extern unsigned long __ms_kern_heap_start__;
extern unsigned long __ms_kern_text_start__;
extern unsigned long __ms_kern_text_end__;
ms_mem_layout_t mem_layout[] = {
[MS_FLASH_REGION] = {
BSP_CFG_ROM_BASE,
BSP_CFG_ROM_SIZE,
},
[MS_KERN_TEXT_REGION] = {
(ms_addr_t)&__ms_kern_text_start__,
(ms_addr_t)&__ms_kern_text_end__ - (ms_addr_t)&__ms_kern_text_start__,
},
[MS_KERN_DATA_REGION] = {
BSP_CFG_KERN_RAM_BASE,
BSP_CFG_KERN_RAM_SIZE,
},
[MS_KERN_HEAP_REGION] = {
(ms_addr_t)&__ms_kern_heap_start__,
BSP_CFG_KERN_HEAP_SIZE,
},
[MS_SHARED_MEM_REGION] = {
BSP_CFG_SHARED_RAM_BASE,
BSP_CFG_SHARED_RAM_SIZE,
},
[MS_PROCESS_MEM_REGION] = {
BSP_CFG_APP_RAM_BASE,
BSP_CFG_APP_RAM_SIZE,
},
};
ms_rtos_init(mem_layout);
#if MS_CFG_IO_MODULE_EN > 0
ms_trace_drv_register();
ms_trace_dev_register("/dev/console");
ms_stdfile_init();
#endif
ms_app_init();
ms_rtos_start();
while (MS_TRUE) {
}
}
/*********************************************************************************************************
END
*********************************************************************************************************/
config.h BSP 配置头文件
下面是 config.h
配置头文件模板:
/*********************************************************************************************************
**
** 北京翼辉信息技术有限公司
**
** 微型安全实时操作系统
**
** MS-RTOS(TM)
**
** Copyright All Rights Reserved
**
**--------------文件信息--------------------------------------------------------------------------------
**
** 文 件 名: config.h
**
** 创 建 人: IoT Studio
**
** 文件创建日期: $(SylixOS_Create_Date)
**
** 描 述: 本文件由 IoT Studio 生成,用于配置 BSP 相关地址信息
*********************************************************************************************************/
#ifndef __BSP_CONFIG_H
#define __BSP_CONFIG_H
/*********************************************************************************************************
ROM RAM 相关配置
*********************************************************************************************************/
#define BSP_CFG_USE_BOOTLOADER 0
#define BSP_CFG_CPU_HAS_CACHE 0
#define BSP_CFG_ROM_BASE (0x08000000)
#define BSP_CFG_ROM_SIZE (512 * 1024)
#define BSP_CFG_RAM_BASE (0x20000000)
#define BSP_CFG_RAM_SIZE (256 * 1024)
#define BSP_CFG_KERN_ROM_BASE (0x08000000)
#define BSP_CFG_KERN_ROM_SIZE (256 * 1024)
#define BSP_CFG_KERN_RAM_BASE (0x20000000)
#define BSP_CFG_KERN_RAM_SIZE (64 * 1024)
#define BSP_CFG_KERN_HEAP_SIZE (36 * 1024)
#define BSP_CFG_BOOT_STACK_SIZE (2048)
#define BSP_CFG_SHARED_RAM_BASE (BSP_CFG_KERN_RAM_BASE + BSP_CFG_KERN_RAM_SIZE)
#define BSP_CFG_SHARED_RAM_SIZE (64 * 1024)
#define BSP_CFG_APP_RAM_BASE (BSP_CFG_SHARED_RAM_BASE + BSP_CFG_SHARED_RAM_SIZE)
#define BSP_CFG_APP_RAM_SIZE (128 * 1024)
#endif /* __BSP_CONFIG_H */
/*********************************************************************************************************
END
*********************************************************************************************************/
config.ld 链接脚本配置文件
下面是 config.ld
链接脚本配置文件模板:
/*********************************************************************************************************
**
** 北京翼辉信息技术有限公司
**
** 微型安全实时操作系统
**
** MS-RTOS(TM)
**
** Copyright All Rights Reserved
**
**--------------文件信息--------------------------------------------------------------------------------
**
**
** 文 件 名: config.ld
**
** 创 建 人: IoT Studio
**
** 文件创建日期: $(SylixOS_Create_Date)
**
** 描 述: 本文件由 IoT Studio 生成,用于配置链接脚本
*********************************************************************************************************/
#include "config.h"
/*********************************************************************************************************
内存布局定义
*********************************************************************************************************/
MEMORY
{
FLASH (rx) : ORIGIN = BSP_CFG_KERN_ROM_BASE, LENGTH = BSP_CFG_KERN_ROM_SIZE
RAM (xrw) : ORIGIN = BSP_CFG_KERN_RAM_BASE, LENGTH = BSP_CFG_KERN_RAM_SIZE
}
BOOT_STACK_SIZE = BSP_CFG_BOOT_STACK_SIZE;
KERN_HEAP_SIZE = BSP_CFG_KERN_HEAP_SIZE;
/*********************************************************************************************************
END
*********************************************************************************************************/
MS-RTOS.ld 链接脚本
下面是 MS-RTOS.ld
链接脚本模板:
/*********************************************************************************************************
**
** 北京翼辉信息技术有限公司
**
** 微型安全实时操作系统
**
** MS-RTOS(TM)
**
** Copyright All Rights Reserved
**
**--------------文件信息--------------------------------------------------------------------------------
**
** 文 件 名: MS-RTOS.ld
**
** 创 建 人: IoT Studio
**
** 文件创建日期: $(SylixOS_Create_Date)
**
** 描 述: $(SylixOS_Project_Name) 链接脚本文件
*********************************************************************************************************/
INCLUDE "config.lds"
/* Entry Point */
ENTRY(Reset_Handler)
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
.isr_vector : {
. = ALIGN(4);
PROVIDE(__vector_start__ = .);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data goes into FLASH */
.text : {
. = ALIGN(4);
PROVIDE (__ms_kern_text_start__ = .);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
PROVIDE (__ms_kern_text_end__ = .);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(8);
PROVIDE (__ms_shell_cmd_start__ = .);
KEEP(*(.ms_shell_cmd*))
PROVIDE (__ms_shell_cmd_end__ = .);
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
KEEP (*(.init))
KEEP (*(.fini))
PROVIDE(__ctors_start__ = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE(__ctors_end__ = .);
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH
.ARM.attributes : { *(.ARM.attributes) } > FLASH
/* used by the startup to initialize data */
. = ALIGN(8);
_sidata = .;
/* Initialized data sections goes into RAM, load LMA copy after code */
.data : AT ( _sidata ) {
. = ALIGN(8);
_sdata = .; /* create a global symbol at data start */
PROVIDE(__ms_segger_rtt_start__ = .);
*(.ms_segger_rtt) /* .ms_segger_rtt sections */
PROVIDE(__ms_segger_rtt_end__ = .);
*(.data) /* .data sections */
*(.data*) /* .data* sections */
PROVIDE(__dtors_start__ = .);
KEEP(*(SORT(.dtors.*)))
KEEP(*(.dtors))
PROVIDE(__dtors_end__ = .);
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM
/* Uninitialized data section */
.bss : {
. = ALIGN(8);
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
PROVIDE ( end = _ebss );
PROVIDE ( _end = _ebss );
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack : {
. = ALIGN(8);
PROVIDE ( __ms_kern_heap_start__ = . );
. = . + KERN_HEAP_SIZE;
. = ALIGN(0x80);
PROVIDE(__ms_boot_stack_end__ = .);
. = . + BOOT_STACK_SIZE;
. = ALIGN(8);
PROVIDE(__ms_boot_stack_start__ = .);
} >RAM
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
}
/*********************************************************************************************************
END
*********************************************************************************************************/