mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
tms320f28379d fix init (#6343)
解决 tms320f28379d bsp 启动的问题。主要改动如下。 修正context.s中汇编代码错误。在旧版的代码中,操作数为32位而汇编命令却使用了针对16位数据的命令MOV,导致程序在某些情况无法正常启动线程。 由于C28x的平台下,SP只支持16bit寻址,所以用于线程空间存放的heap以及ebss段都需要放在低16位的空间,针对这个问题修改了CMD文件。此外还增加基于CMD文件基于RAM的支持,方便调试。 新增rtdef.h中RT_SECTION,RT_USED,ALIGN和RT_WEAK的定义。旧版bsp中这些定义为空,导致INIT_EXPORT注册的函数失效。 修改程序启动代码,在程序入口直接调用原生启动代码 以上改动在LAUNCHXL-F28379D 通过了测试。
This commit is contained in:
+289
-39
File diff suppressed because it is too large
Load Diff
+242
-40
File diff suppressed because it is too large
Load Diff
@@ -1 +1,3 @@
|
||||
.launches/
|
||||
.launches/
|
||||
/FLASH/
|
||||
/RAM/
|
||||
|
||||
@@ -24,3 +24,53 @@ encoding//Debug/objects.mk=UTF-8
|
||||
encoding//Debug/sources.mk=UTF-8
|
||||
encoding//Debug/subdir_rules.mk=UTF-8
|
||||
encoding//Debug/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/DeviceDrivers/ipc/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/DeviceDrivers/ipc/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/DeviceDrivers/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/DeviceDrivers/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/Kernel/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/Kernel/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/applications/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/applications/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/c28x/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/c28x/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/drivers/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/drivers/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/finsh/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/finsh/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/libraries/common/source/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/libraries/common/source/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/libraries/headers/cmd/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/libraries/headers/cmd/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/libraries/headers/source/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/libraries/headers/source/subdir_vars.mk=UTF-8
|
||||
encoding//FLASH/makefile=UTF-8
|
||||
encoding//FLASH/objects.mk=UTF-8
|
||||
encoding//FLASH/sources.mk=UTF-8
|
||||
encoding//FLASH/subdir_rules.mk=UTF-8
|
||||
encoding//FLASH/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/DeviceDrivers/ipc/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/DeviceDrivers/ipc/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/DeviceDrivers/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/DeviceDrivers/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/Kernel/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/Kernel/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/applications/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/applications/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/c28x/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/c28x/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/drivers/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/drivers/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/finsh/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/finsh/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/libraries/common/source/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/libraries/common/source/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/libraries/headers/cmd/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/libraries/headers/cmd/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/libraries/headers/source/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/libraries/headers/source/subdir_vars.mk=UTF-8
|
||||
encoding//RAM/makefile=UTF-8
|
||||
encoding//RAM/objects.mk=UTF-8
|
||||
encoding//RAM/sources.mk=UTF-8
|
||||
encoding//RAM/subdir_rules.mk=UTF-8
|
||||
encoding//RAM/subdir_vars.mk=UTF-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
___heap_end = 0x010000;
|
||||
MEMORY
|
||||
{
|
||||
PAGE 0 : /* Program Memory */
|
||||
@@ -6,14 +6,8 @@ PAGE 0 : /* Program Memory */
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
|
||||
BEGIN : origin = 0x080000, length = 0x000002
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMGS14 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01B000, length = 0x001000
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
RAMGS8_15 : origin = 0x013000, length = 0x009000
|
||||
|
||||
/* Flash sectors */
|
||||
FLASHA : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
|
||||
@@ -33,31 +27,10 @@ PAGE 0 : /* Program Memory */
|
||||
|
||||
PAGE 1 : /* Data Memory */
|
||||
/* Memory (RAM/FLASH) blocks can be moved to PAGE0 for program allocation */
|
||||
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x000120 /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
|
||||
RAMD1 : origin = 0x00B800, length = 0x000800
|
||||
RAMM0 : origin = 0x000122, length = 0x0002DE
|
||||
RAMD0 : origin = 0x00B000, length = 0x000800
|
||||
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
|
||||
RAMGS0 : origin = 0x00C000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS3 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS4 : origin = 0x010000, length = 0x001000
|
||||
RAMGS5 : origin = 0x011000, length = 0x001000
|
||||
RAMGS6 : origin = 0x012000, length = 0x001000
|
||||
RAMGS7 : origin = 0x013000, length = 0x001000
|
||||
RAMGS8 : origin = 0x014000, length = 0x001000
|
||||
RAMGS9 : origin = 0x015000, length = 0x001000
|
||||
RAMGS10 : origin = 0x016000, length = 0x001000
|
||||
RAMGS11 : origin = 0x017000, length = 0x001000
|
||||
RAMGS12 : origin = 0x018000, length = 0x001000
|
||||
RAMGS13 : origin = 0x019000, length = 0x001000
|
||||
|
||||
|
||||
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
|
||||
EBSS : origin = 0x008000, length = 0x008000 /* RAMLS0-4, 5*0x0800 */
|
||||
CPU2TOCPU1RAM : origin = 0x03F800, length = 0x000400
|
||||
CPU1TOCPU2RAM : origin = 0x03FC00, length = 0x000400
|
||||
}
|
||||
@@ -66,15 +39,15 @@ PAGE 1 : /* Data Memory */
|
||||
SECTIONS
|
||||
{
|
||||
/* Allocate program areas: */
|
||||
.cinit : > FLASHB PAGE = 0, ALIGN(4)
|
||||
.pinit : > FLASHB, PAGE = 0, ALIGN(4)
|
||||
.text : >> FLASHB | FLASHC | FLASHD | FLASHE PAGE = 0, ALIGN(4)
|
||||
.cinit : > FLASHF PAGE = 0, ALIGN(4)
|
||||
.pinit : > FLASHF, PAGE = 0, ALIGN(4)
|
||||
.text : >> FLASHE PAGE = 0, ALIGN(4)
|
||||
codestart : > BEGIN PAGE = 0, ALIGN(4)
|
||||
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 15009000
|
||||
.TI.ramfunc : {} LOAD = FLASHD,
|
||||
RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
|
||||
.TI.ramfunc : {} LOAD = FLASHF,
|
||||
RUN = RAMGS8_15,
|
||||
LOAD_START(_RamfuncsLoadStart),
|
||||
LOAD_SIZE(_RamfuncsLoadSize),
|
||||
LOAD_END(_RamfuncsLoadEnd),
|
||||
@@ -83,8 +56,8 @@ SECTIONS
|
||||
RUN_END(_RamfuncsRunEnd),
|
||||
PAGE = 0, ALIGN(4)
|
||||
#else
|
||||
ramfuncs : LOAD = FLASHD,
|
||||
RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
|
||||
ramfuncs : LOAD = FLASHF,
|
||||
RUN = RAMGS8_15,
|
||||
LOAD_START(_RamfuncsLoadStart),
|
||||
LOAD_SIZE(_RamfuncsLoadSize),
|
||||
LOAD_END(_RamfuncsLoadEnd),
|
||||
@@ -95,25 +68,32 @@ SECTIONS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
FSymTab : > RAMD0, PAGE = 1, ALIGN(4)
|
||||
FSymTab : > RAMM1, PAGE = 1, ALIGN(4)
|
||||
LOAD_START(___fsymtab_start)
|
||||
LOAD_END(___fsymtab_end)
|
||||
|
||||
.rti_fn.0.end : > RAMM1, PAGE = 1
|
||||
.rti_fn.0 : > RAMM1, PAGE = 1
|
||||
.rti_fn.1 : > RAMM1, PAGE = 1
|
||||
.rti_fn.2 : > RAMM1, PAGE = 1
|
||||
.rti_fn.3 : > RAMM1, PAGE = 1
|
||||
.rti_fn.4 : > RAMM1, PAGE = 1
|
||||
.rti_fn.5 : > RAMM1, PAGE = 1
|
||||
.rti_fn.1.end : > RAMM1, PAGE = 1
|
||||
.rti_fn.6.end : > RAMM1, PAGE = 1
|
||||
.rti_fn.6 : > RAMM1, PAGE = 1
|
||||
/* Allocate uninitalized data sections: */
|
||||
.stack : > RAMM1 PAGE = 1
|
||||
.ebss : >> RAMLS5 | RAMGS0 | RAMGS1 PAGE = 1
|
||||
.esysmem : >> RAMGS2 | RAMGS3 | RAMGS4 | RAMGS5 | RAMGS6 | RAMGS7 | RAMGS8 | RAMGS9 | RAMGS10 | RAMGS11 | RAMGS12 | RAMGS13 PAGE = 1
|
||||
.ebss : > EBSS,
|
||||
LOAD_START(___ebss_start),
|
||||
LOAD_END(___ebss_end),
|
||||
PAGE = 1
|
||||
.esysmem : >> RAMM1 PAGE = 1
|
||||
|
||||
/* Initalized sections go in Flash */
|
||||
.econst : >> FLASHF | FLASHG | FLASHH PAGE = 0, ALIGN(4)
|
||||
.switch : > FLASHB PAGE = 0, ALIGN(4)
|
||||
.econst : >> FLASHF PAGE = 0, ALIGN(4)
|
||||
.switch : > FLASHF PAGE = 0, ALIGN(4)
|
||||
|
||||
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
|
||||
|
||||
Filter_RegsFile : > RAMGS0, PAGE = 1
|
||||
|
||||
SHARERAMGS0 : > RAMGS0, PAGE = 1
|
||||
SHARERAMGS1 : > RAMGS1, PAGE = 1
|
||||
|
||||
/* The following section definitions are required when using the IPC API Drivers */
|
||||
GROUP : > CPU1TOCPU2RAM, PAGE = 1
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
___heap_end = 0x00F000;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
PAGE 0 :
|
||||
/* BEGIN is used for the "boot to SARAM" bootloader mode */
|
||||
|
||||
BEGIN : origin = 0x000000, length = 0x000002
|
||||
RAMM0 : origin = 0x000122, length = 0x0002DE
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
RAMGS8_15 : origin = 0x013000, length = 0x009000
|
||||
|
||||
PAGE 1 :
|
||||
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x000120 /* Part of M0, BOOT rom will use this for stack */
|
||||
EBSS : origin = 0x008000, length = 0x007000 /* RAMLS0-4, 5*0x0800 */
|
||||
ECONST : origin = 0x00F000, length = 0x004000 /* RAMGS0-2, 3*0x1000 */
|
||||
CPU2TOCPU1RAM : origin = 0x03F800, length = 0x000400
|
||||
CPU1TOCPU2RAM : origin = 0x03FC00, length = 0x000400
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, PAGE = 0
|
||||
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 15009000
|
||||
.TI.ramfunc : {} > RAMM0, PAGE = 0
|
||||
#else
|
||||
ramfuncs : > RAMM0 PAGE = 0
|
||||
#endif
|
||||
#endif
|
||||
.text : > RAMGS8_15, PAGE = 0
|
||||
.cinit : > RAMM0, PAGE = 0
|
||||
.pinit : > RAMM0, PAGE = 0
|
||||
.switch : > RAMM0, PAGE = 0
|
||||
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
|
||||
.rti_fn.0.end : > RAMM1, PAGE = 1
|
||||
.rti_fn.0 : > RAMM1, PAGE = 1
|
||||
.rti_fn.1.end : > RAMM1, PAGE = 1
|
||||
.rti_fn.6.end : > RAMM1, PAGE = 1
|
||||
.rti_fn.6 : > RAMM1, PAGE = 1
|
||||
.stack : > RAMM1, PAGE = 1
|
||||
.esysmem : > RAMM1, PAGE = 1
|
||||
|
||||
.ebss : > EBSS,
|
||||
LOAD_START(___ebss_start),
|
||||
LOAD_END(___ebss_end),
|
||||
PAGE = 1
|
||||
|
||||
.econst : > ECONST, PAGE = 1
|
||||
|
||||
/* finsh symbol table */
|
||||
FSymTab : > RAMM1, PAGE = 1, ALIGN(4)
|
||||
LOAD_START(___fsymtab_start)
|
||||
LOAD_END(___fsymtab_end)
|
||||
|
||||
/* The following section definitions are required when using the IPC API Drivers */
|
||||
GROUP : > CPU1TOCPU2RAM, PAGE = 1
|
||||
{
|
||||
PUTBUFFER
|
||||
PUTWRITEIDX
|
||||
GETREADIDX
|
||||
}
|
||||
|
||||
GROUP : > CPU2TOCPU1RAM, PAGE = 1
|
||||
{
|
||||
GETBUFFER : TYPE = DSECT
|
||||
GETWRITEIDX : TYPE = DSECT
|
||||
PUTREADIDX : TYPE = DSECT
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -22,7 +22,7 @@ config SOC_TMS320F28X
|
||||
bool
|
||||
select ARCH_TIDSP_C28X
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
# select RT_USING_USER_MAIN
|
||||
select RT_USING_USER_MAIN
|
||||
default y
|
||||
|
||||
source "$RTT_DIR/Kconfig"
|
||||
|
||||
@@ -46,10 +46,9 @@ TMS320F28379D 程序的编译和下载要使用的是 TI 官方提供的 Code Co
|
||||

|
||||
|
||||
### 2.2 编译工程
|
||||
使用 CCS 内置的 C 编译器可以进行工程的编译。CCS 8 需要使用 TI v18.1.3.LTS 编译器。CCS 10 需要使用 TI v20.2.1.LTS 及以上版本编译器(v20.2.0.LTS及以下版本的编译器有bug编译时会出现segmentation fault)。本文使用的是 Code Composer Studio 10.1.1 和 TI v20.2.4.LTS 编译器的组合(已经配置在工程文件中)。导入工程后,在右边的 Project Explorer 列表里可以看到刚刚导入的 rt-thread 工程,右键点击,在弹出的菜单中选择 Build Project 即可开始编译。
|
||||
|
||||

|
||||
|
||||
使用 CCS 内置的 C 编译器可以进行工程的编译。CCS 8 需要使用 TI v18.1.3.LTS 编译器。CCS 10 需要使用 TI v20.2.1.LTS 及以上版本编译器(v20.2.0.LTS及以下版本的编译器有bug编译时会出现segmentation fault)。本文使用的是 Code Composer Studio 10.1.1 和 TI v20.2.4.LTS 编译器的组合(已经配置在工程文件中)。导入工程后,在右边的 Project Explorer 列表里可以看到刚刚导入的 rt-thread 工程。本BSP提供两种编译的方式,分别用于在RAM中执行和在FLASH中执行。
|
||||
如图所示可以选择RAM和FLASH进行build。
|
||||

|
||||
## 3. 烧写及执行
|
||||
|
||||
编译完成后,可以开始下载和调试。把开发板和电脑通过 Mini-USB 线连接,使用 CCS 中的烧写功能可直接通过板载 XDS100v2 仿真器烧写并执行。
|
||||
@@ -94,9 +93,9 @@ TMS320F28379D 程序的编译和下载要使用的是 TI 官方提供的 Code Co
|
||||
|
||||
## 6. 联系人信息
|
||||
|
||||
维护人:xuzhuoyi < xzy476386434@vip.qq.com >
|
||||
qiyu < qiyu_sjtu@163.com >
|
||||
guyunjie < yunjie.gu1@gmail.com >
|
||||
维护人:
|
||||
1. guyunjie < yunjie.gu1@gmail.com >
|
||||
2. qiyu < qiyu_sjtu@163.com >
|
||||
|
||||
## 7. 参考
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-01-05 Bernard the first version
|
||||
* 2014-04-27 Bernard make code cleanup.
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include "shell.h"
|
||||
#endif
|
||||
|
||||
void rt_init_thread_entry(void* parameter)
|
||||
{
|
||||
#ifdef RT_USING_FINSH
|
||||
finsh_system_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
int rt_application_init()
|
||||
{
|
||||
rt_thread_t tid;
|
||||
|
||||
tid = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, RT_THREAD_PRIORITY_MAX/3, 20);
|
||||
|
||||
if (tid != RT_NULL)
|
||||
rt_thread_startup(tid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -7,80 +7,22 @@
|
||||
* Date Author Notes
|
||||
* 2006-08-31 Bernard first implementation
|
||||
* 2018-09-02 xuzhuoyi modify for TMS320F28379D version
|
||||
* 2022-08-21 yuqi modify the entry function
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "board.h"
|
||||
|
||||
|
||||
/*@{*/
|
||||
|
||||
extern int rt_application_init(void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : assert_failed
|
||||
* Description : Reports the name of the source file and the source line number
|
||||
* where the assert error has occurred.
|
||||
* Input : - file: pointer to the source file name
|
||||
* - line: assert error line source number
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void assert_failed(uint16_t* file, uint32_t line)
|
||||
{
|
||||
rt_kprintf("\n\r Wrong parameter value detected on\r\n");
|
||||
rt_kprintf(" file %s\r\n", file);
|
||||
rt_kprintf(" line %d\r\n", line);
|
||||
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will startup RT-Thread RTOS.
|
||||
*/
|
||||
void rtthread_startup(void)
|
||||
{
|
||||
/* init board */
|
||||
rt_hw_board_init();
|
||||
|
||||
/* show version */
|
||||
rt_show_version();
|
||||
|
||||
/* init timer system */
|
||||
rt_system_timer_init();
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
/* init timer thread */
|
||||
rt_system_timer_thread_init();
|
||||
|
||||
/* init idle thread */
|
||||
rt_thread_idle_init();
|
||||
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
|
||||
/* never reach here */
|
||||
return ;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* disable interrupt first */
|
||||
rt_hw_interrupt_disable();
|
||||
unsigned long x=10000;
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
return 0;
|
||||
while(x)
|
||||
{
|
||||
x--;
|
||||
}
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* 2009-09-22 Bernard add board.h to this bsp
|
||||
* 2018-09-02 xuzhuoyi modify for TMS320F28379D version
|
||||
* 2022-06-21 guyunjie fix bugs in trap_rtosint and enable interrupt nesting
|
||||
* 2022-08-21 yuqi adding onboard devices initialization code
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include "board.h"
|
||||
@@ -21,7 +22,6 @@ extern volatile rt_uint8_t rt_interrupt_nest;
|
||||
extern rt_uint32_t rt_thread_switch_interrupt_flag;
|
||||
|
||||
extern interrupt void RTOSINT_Handler();
|
||||
|
||||
void trap_rtosint()
|
||||
{
|
||||
if(rt_thread_switch_interrupt_flag)
|
||||
@@ -75,6 +75,10 @@ void rt_hw_board_init()
|
||||
|
||||
InitPieVectTable();
|
||||
|
||||
#ifdef _FLASH
|
||||
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (Uint32)&RamfuncsLoadSize);
|
||||
InitFlash();
|
||||
#endif
|
||||
EALLOW; // This is needed to write to EALLOW protected registers
|
||||
PieVectTable.TIMER2_INT = &cpu_timer2_isr;
|
||||
PieVectTable.RTOS_INT = &RTOSINT_Handler;
|
||||
@@ -86,10 +90,12 @@ void rt_hw_board_init()
|
||||
IER |= M_INT14;
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
|
||||
rt_system_heap_init(&__ebss_end, &(__heap_end));
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_SERIAL
|
||||
rt_hw_sci_init();
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
@@ -97,6 +103,19 @@ void rt_hw_board_init()
|
||||
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
/*this hook may cause problem for reasons unknown*/
|
||||
|
||||
rt_interrupt_leave_sethook((void (*)(void))trap_rtosint);
|
||||
}
|
||||
|
||||
int _args_main()
|
||||
{
|
||||
/* _args_main is the entry point called by _c_int00. We define it
|
||||
* here to override the one defined by the compiler in args_main.c */
|
||||
|
||||
extern int rtthread_startup();
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
/* never reach here*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -14,10 +14,9 @@
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#define C28X_SRAM_END 0x00020000
|
||||
|
||||
#define HEAP_BEGIN 0x0000E000
|
||||
#define HEAP_END C28X_SRAM_END
|
||||
extern int __ebss_end;
|
||||
extern int __heap_end;
|
||||
|
||||
extern void rt_hw_board_init(void);
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 20 KiB |
@@ -53,6 +53,9 @@
|
||||
/* RT-Thread Components */
|
||||
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
#define RT_USING_USER_MAIN
|
||||
#define RT_MAIN_THREAD_STACK_SIZE 2048
|
||||
#define RT_MAIN_THREAD_PRIORITY 4
|
||||
#define RT_USING_MSH
|
||||
#define RT_USING_FINSH
|
||||
#define FINSH_USING_MSH
|
||||
@@ -121,24 +124,58 @@
|
||||
|
||||
/* language packages */
|
||||
|
||||
/* JSON: JavaScript Object Notation, a lightweight data-interchange format */
|
||||
|
||||
|
||||
/* XML: Extensible Markup Language */
|
||||
|
||||
|
||||
/* multimedia packages */
|
||||
|
||||
/* LVGL: powerful and easy-to-use embedded GUI library */
|
||||
|
||||
|
||||
/* u8g2: a monochrome graphic library */
|
||||
|
||||
|
||||
/* PainterEngine: A cross-platform graphics application framework written in C language */
|
||||
|
||||
|
||||
/* tools packages */
|
||||
|
||||
|
||||
/* system packages */
|
||||
|
||||
/* enhanced kernel services */
|
||||
|
||||
|
||||
/* acceleration: Assembly language or algorithmic acceleration packages */
|
||||
|
||||
|
||||
/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
|
||||
|
||||
|
||||
/* Micrium: Micrium software products porting for RT-Thread */
|
||||
|
||||
|
||||
/* peripheral libraries and drivers */
|
||||
|
||||
|
||||
/* Kendryte SDK */
|
||||
|
||||
|
||||
/* AI packages */
|
||||
|
||||
|
||||
/* miscellaneous packages */
|
||||
|
||||
/* project laboratory */
|
||||
|
||||
/* samples: kernel and components samples */
|
||||
|
||||
|
||||
/* entertainment: terminal games and other interesting software packages */
|
||||
|
||||
#include "rtconfig_project.h"
|
||||
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -208,11 +208,11 @@ typedef __gnuc_va_list va_list;
|
||||
/* The way that TI compiler set section is different from other(at least
|
||||
* GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more
|
||||
* details. */
|
||||
#define RT_SECTION(x)
|
||||
#define RT_USED
|
||||
#define RT_SECTION(x) __attribute__((section(x)))
|
||||
#define RT_USED __attribute__((used))
|
||||
#define PRAGMA(x) _Pragma(#x)
|
||||
#define ALIGN(n)
|
||||
#define RT_WEAK
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
#define RT_WEAK __attribute__((weak))
|
||||
#define rt_inline static inline
|
||||
#define RTT_API
|
||||
#elif defined (__TASKING__)
|
||||
|
||||
+61
-102
File diff suppressed because it is too large
Load Diff
@@ -76,9 +76,8 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
|
||||
unsigned long i;
|
||||
|
||||
stk = stack_addr;
|
||||
stk = (rt_uint8_t *)RT_ALIGN((rt_uint32_t)stk, 8);
|
||||
//stk -= sizeof(struct stack_frame);
|
||||
stk += 1;
|
||||
stk = (rt_uint8_t *)RT_ALIGN((rt_uint32_t)stk, 2);
|
||||
stk += 1; /*to work around the stack alignment*/
|
||||
|
||||
stack_frame = (struct stack_frame *)stk;
|
||||
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -145,7 +145,6 @@ int $Sub$$main(void)
|
||||
return 0;
|
||||
}
|
||||
#elif defined(__ICCARM__)
|
||||
extern int main(void);
|
||||
/* __low_level_init will auto called by IAR cstartup */
|
||||
extern void __iar_data_init3(void);
|
||||
int __low_level_init(void)
|
||||
@@ -194,7 +193,7 @@ void main_thread_entry(void *parameter)
|
||||
extern int $Super$$main(void);
|
||||
$Super$$main(); /* for ARMCC. */
|
||||
}
|
||||
#elif defined(__ICCARM__) || defined(__GNUC__) || defined(__TASKING__)
|
||||
#elif defined(__ICCARM__) || defined(__GNUC__) || defined(__TASKING__) || defined(__TI_COMPILER_VERSION__)
|
||||
main();
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user