mirror of
https://github.com/HEYAHONG/rt-thread-no-bsp.git
synced 2025-05-08 07:45:49 +08:00
update by jenkins(20250501001530)
This commit is contained in:
parent
0fc1a73554
commit
801aebf1a0
23
rt-thread-no-bsp/.github/ALL_BSP_COMPILE.json
vendored
23
rt-thread-no-bsp/.github/ALL_BSP_COMPILE.json
vendored
@ -53,6 +53,7 @@
|
||||
"at32/at32m412-start",
|
||||
"at32/at32m416-start",
|
||||
"hc32/ev_hc32f4a0_lqfp176",
|
||||
"hc32/ev_hc32f4a8_lqfp176",
|
||||
"hc32/ev_hc32f448_lqfp80",
|
||||
"hc32/ev_hc32f460_lqfp100_v2",
|
||||
"hc32/ev_hc32f472_lqfp100",
|
||||
@ -68,7 +69,7 @@
|
||||
"RTT_BSP": "others_ft32_mm32_acm32",
|
||||
"RTT_TOOL_CHAIN": "sourcery-arm",
|
||||
"SUB_RTT_BSP": [
|
||||
"qemu-vexpress-a9",
|
||||
"phytium/aarch32",
|
||||
"airm2m/air32f103",
|
||||
"acm32/acm32f0x0-nucleo",
|
||||
"acm32/acm32f0x0-nucleo",
|
||||
@ -337,6 +338,7 @@
|
||||
"Infineon/psoc6-cy8cproto-062S3-4343W",
|
||||
"Infineon/psoc6-evaluationkit-062S2",
|
||||
"Infineon/xmc7200-kit_xmc7200_evk",
|
||||
"Infineon/xmc7100d-f144k4160aa",
|
||||
"fujitsu/mb9x/mb9bf500r",
|
||||
"fujitsu/mb9x/mb9bf506r",
|
||||
"fujitsu/mb9x/mb9bf618s",
|
||||
@ -369,6 +371,7 @@
|
||||
"RTT_BSP": "aarch64",
|
||||
"RTT_TOOL_CHAIN": "sourcery-aarch64",
|
||||
"SUB_RTT_BSP": [
|
||||
"phytium/aarch64",
|
||||
"qemu-virt64-aarch64",
|
||||
"raspberry-pi/raspi3-64",
|
||||
"raspberry-pi/raspi4-64"
|
||||
@ -390,7 +393,15 @@
|
||||
"SUB_RTT_BSP": [
|
||||
"bluetrum/ab32vg1-ab-prougen",
|
||||
"bouffalo_lab/bl60x",
|
||||
"bouffalo_lab/bl70x"
|
||||
"bouffalo_lab/bl70x",
|
||||
"qemu-virt64-riscv"
|
||||
]
|
||||
},
|
||||
{
|
||||
"RTT_BSP": "K230",
|
||||
"RTT_TOOL_CHAIN": "riscv64-unknown-linux-musl-",
|
||||
"SUB_RTT_BSP": [
|
||||
"k230"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -446,6 +457,14 @@
|
||||
"nrf5x/nrf52840",
|
||||
"nrf5x/nrf5340"
|
||||
]
|
||||
},
|
||||
{
|
||||
"RTT_BSP": "arm-none-bsp-smart",
|
||||
"RTT_TOOL_CHAIN": "sourcery-arm",
|
||||
"RTT_SMART_TOOL_CHAIN": "arm-linux-musleabi",
|
||||
"SUB_RTT_BSP": [
|
||||
"qemu-vexpress-a9"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -183,6 +183,14 @@ jobs:
|
||||
/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version
|
||||
echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV
|
||||
|
||||
- name: Install k230 MUSL ToolChains
|
||||
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'riscv64-unknown-linux-musl-' && matrix.legs.RTT_BSP == 'K230' && success() }}
|
||||
run: |
|
||||
wget -q https://download.rt-thread.org/rt-smart/riscv64/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu_251248.tar.bz2
|
||||
sudo tar xjf riscv64-linux-musleabi_for_x86_64-pc-linux-gnu_251248.tar.bz2 -C /opt
|
||||
/opt/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/riscv64-unknown-linux-musl-gcc --version
|
||||
echo "RTT_EXEC_PATH=/opt/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin" >> $GITHUB_ENV
|
||||
|
||||
- name: Install riscv32-unknown-elf Toolchains
|
||||
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'RISC-V-GCC-RV32' && success() }}
|
||||
run: |
|
||||
@ -208,6 +216,14 @@ jobs:
|
||||
pip3 install esptool
|
||||
echo "RTT_EXEC_PATH=/opt/riscv32-esp-elf/bin" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Arm Musl ToolChains
|
||||
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm' && matrix.legs.RTT_SMART_TOOL_CHAIN == 'arm-linux-musleabi' && success() }}
|
||||
shell: bash
|
||||
run: |
|
||||
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.7/arm-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2
|
||||
sudo tar xjf arm-linux-musleabi_for_x86_64-pc-linux-gnu_stable.tar.bz2 -C /opt
|
||||
/opt/arm-linux-musleabi_for_x86_64-pc-linux-gnu/bin/arm-linux-musleabi-gcc --version
|
||||
|
||||
- name: Install Simulator Tools
|
||||
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'gcc' && success() }}
|
||||
run: |
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "ofw_internal.h"
|
||||
|
||||
struct rt_fdt_earlycon fdt_earlycon rt_section(".bss.noclean.earlycon");
|
||||
struct rt_fdt_earlycon fdt_earlycon;
|
||||
|
||||
RT_OFW_SYMBOL_TYPE_RANGE(earlycon, struct rt_fdt_earlycon_id, _earlycon_start = {}, _earlycon_end = {});
|
||||
|
||||
|
@ -89,7 +89,7 @@ if GetDepend(['RT_CHERRYUSB_DEVICE']):
|
||||
else:
|
||||
src += Glob('port/ch32/usb_dc_usbfs.c')
|
||||
if GetDepend(['RT_CHERRYUSB_DEVICE_PUSB2']):
|
||||
path += [cwd + '/port/xhci/rt-thread']
|
||||
path += [cwd + '/port/pusb2/rt-thread']
|
||||
src += Glob('port/pusb2/rt-thread/usb_dc_glue_phytium.c')
|
||||
if GetDepend(['ARCH_ARMV8']):
|
||||
LIBPATH = [cwd + '/port/pusb2']
|
||||
|
@ -60,8 +60,8 @@ extern "C" {
|
||||
typedef enum
|
||||
{
|
||||
RT_WLAN_EVT_READY = 0, /* connect and prot is ok, You can send data*/
|
||||
RT_WLAN_EVT_SCAN_DONE, /* Scan a info */
|
||||
RT_WLAN_EVT_SCAN_REPORT, /* Scan end */
|
||||
RT_WLAN_EVT_SCAN_DONE, /* Scan end */
|
||||
RT_WLAN_EVT_SCAN_REPORT, /* Scan a info */
|
||||
RT_WLAN_EVT_STA_CONNECTED, /* connect success */
|
||||
RT_WLAN_EVT_STA_CONNECTED_FAIL, /* connection failed */
|
||||
RT_WLAN_EVT_STA_DISCONNECTED, /* disconnect */
|
||||
|
@ -106,3 +106,222 @@ Flash 分区基于 Flash 设备,每个 Flash 设备又可以有 N 个分区,
|
||||
- 分区的起始地址和大小 **不能超过 Flash 设备的地址范围** ,否则会导致包初始化错误
|
||||
|
||||
> 注意:每个分区定义时,除了填写上面介绍的参数属性外,需在前面增加 `FAL_PART_MAGIC_WORD` 属性,末尾增加 `0` (目前用于保留功能)
|
||||
## 3、如何实现读写擦除等操作
|
||||
我们以fal_norflash_port.c为例,简单介绍一下。
|
||||
首先 介绍一下这两个宏定义
|
||||
```C
|
||||
#define FAL_ALIGN_UP( size, align ) \
|
||||
( ( ( size ) + ( align ) - 1 ) - ( ( ( size ) + ( align ) - 1 ) % ( align ) ) )
|
||||
#define FAL_ALIGN_DOWN( size, align ) ( ( ( size ) / ( align ) ) * ( align ) )
|
||||
```
|
||||
ALIGN_UP(16,4)=16 ALIGN_UP(15,4)=16 ALIGN_UP(17,4)=20
|
||||
ALIGN_DOWN(16,4)=16 ALIGN_DOWN(15,4)=12 ALIGN_DOWN(17,4)=16
|
||||
不难看出 ALIGN_UP是一个size向上取整到align的倍数,ALIGN_DOWN则是向下取整到align的倍数。
|
||||
然后 介绍FLASH的特性
|
||||
FLASH都是按块擦除 norflash的块大小一般为4K 单片机内部FLASH的块大小为1K,2K,16K不等
|
||||
同时有最少写入数据的限制
|
||||
norflash中 是按页写入 一次最少写256个字节数据 超过则覆盖起始数据 如第257个数据会覆盖第1个数据的位置
|
||||
单片机内部flash中 一次最少写2个字节数据(STM32F105RC) 且只能将地址2字节对齐写入 只写一个字节时 给后面的字节补成FF
|
||||
实现擦除
|
||||
```C
|
||||
static int32_t get_sector( uint32_t address );//获取当前属于第一个扇区
|
||||
extern void norflash_erase_sector( uint32_t saddr );//负责擦除单个扇区的全部数据
|
||||
//FLASH都是按块擦除 我们假定在调用擦除函数时 用户知道自己将会擦除扇区内的全部数据
|
||||
static int erase( long offset, size_t size )
|
||||
{
|
||||
int32_t cur_erase_sector;
|
||||
uint32_t addr = FLASH_START_ADDR + offset;
|
||||
uint32_t addr_down = FAL_ALIGN_DOWN( addr, FLASH_SECTOR_SIZE );
|
||||
|
||||
uint32_t addr_end = addr + size;
|
||||
uint32_t addr_end_up = FAL_ALIGN_UP( addr_end, FLASH_SECTOR_SIZE );
|
||||
uint32_t cur_addr = addr_down;
|
||||
|
||||
while ( cur_addr < addr_end_up ) {
|
||||
cur_erase_sector = get_sector( cur_addr );
|
||||
if ( cur_erase_sector == -1 ) {//获取第几个扇区失败 说明地址超出范围
|
||||
return cur_addr - addr;
|
||||
}
|
||||
norflash_erase_sector( cur_erase_sector );
|
||||
cur_addr += FLASH_SECTOR_SIZE;//这里如果每个扇区的大小不同 需要实现从当前地址获取扇区实际大小的函数
|
||||
}
|
||||
return size;
|
||||
}
|
||||
```
|
||||
实现读取
|
||||
```c
|
||||
//这个比较简单 直接调用norflash_read即可
|
||||
static int read( long offset, uint8_t* buf, size_t size )
|
||||
{
|
||||
norflash_read( buf, offset + FLASH_START_ADDR, size );
|
||||
return size;
|
||||
}
|
||||
```
|
||||
最后 也是最关键的一步 实现写入
|
||||
```c
|
||||
/* 写入任意长数据到NOR Flash函数 */
|
||||
static int write( long offset, const uint8_t* buf, size_t size )
|
||||
{
|
||||
// 计算实际物理地址(相对于Flash起始地址的偏移)
|
||||
uint32_t addr = FLASH_START_ADDR + offset;
|
||||
// 计算起始地址的扇区向上对齐地址(例如0x1007 -> 0x2000 当扇区大小4K)
|
||||
uint32_t addr_up = FAL_ALIGN_UP( addr, FLASH_SECTOR_SIZE );
|
||||
// 计算起始地址的扇区向下对齐地址(例如0x1007 -> 0x1000)
|
||||
uint32_t addr_down = FAL_ALIGN_DOWN( addr, FLASH_SECTOR_SIZE );
|
||||
|
||||
// 计算写入结束地址
|
||||
uint32_t addr_end = addr + size;
|
||||
// 结束地址的扇区向上对齐地址
|
||||
uint32_t addr_end_up = FAL_ALIGN_UP( addr_end, FLASH_SECTOR_SIZE );
|
||||
// 结束地址的扇区向下对齐地址
|
||||
uint32_t addr_end_down = FAL_ALIGN_DOWN( addr_end, FLASH_SECTOR_SIZE );
|
||||
uint32_t cur_addr = addr_down; // 当前处理的扇区起始地址
|
||||
|
||||
uint32_t max_write_len = 0; // 单次最大可写入长度
|
||||
uint32_t write_len = 0; // 实际写入长度
|
||||
|
||||
// 地址有效性检查:结束地址超过Flash范围 或 起始地址在Flash区域外
|
||||
if ( addr_end_up > FLASH_END_ADDR || ( int )addr_end_down < FLASH_START_ADDR ) return -1;
|
||||
|
||||
// 分配扇区大小的缓冲区(用于处理部分写入时需要保存原始数据的情况)
|
||||
uint8_t* read_sector_buf = FAL_MALLOC( FLASH_SECTOR_SIZE );
|
||||
if ( read_sector_buf == RT_NULL ) {
|
||||
return -2; // 内存分配失败
|
||||
}
|
||||
|
||||
// 按扇区逐个处理(从起始扇区到结束扇区)
|
||||
while ( cur_addr < addr_end_up ) {
|
||||
/* 情况1:处理起始地址不在扇区边界的情况(首扇区部分写入) */
|
||||
if ( cur_addr < addr ) {
|
||||
// 读取整个扇区原始数据到缓冲区
|
||||
read( cur_addr - FLASH_START_ADDR, read_sector_buf, FLASH_SECTOR_SIZE );
|
||||
|
||||
// 计算首扇区可写入的最大长度(从起始地址到扇区末尾)
|
||||
max_write_len = ( addr_up - addr );
|
||||
// 确定实际写入长度(不超过剩余数据大小)
|
||||
write_len = size >= max_write_len ? max_write_len : size;
|
||||
|
||||
// 判断是否需要擦除(检查目标区域是否包含需要从0->1的位)
|
||||
if ( judge_whether_erase( read_sector_buf + addr - cur_addr, write_len ) ){
|
||||
// 需要擦除时:执行擦除->修改缓冲区->写入整个扇区
|
||||
norflash_erase_sector( get_sector( cur_addr ) );
|
||||
// 将新数据合并到缓冲区对应位置
|
||||
FAL_MEMCPY( read_sector_buf + ( addr - cur_addr ), buf, write_len );
|
||||
// 写入整个扇区
|
||||
write_sector( cur_addr, read_sector_buf, FLASH_SECTOR_SIZE );
|
||||
}
|
||||
else {
|
||||
// 无需擦除时直接写入数据(NOR Flash允许直接写入0位)
|
||||
write_sector( addr, buf, write_len );
|
||||
}
|
||||
buf += write_len; // 移动数据指针
|
||||
}
|
||||
/* 情况2:处理结束地址不在扇区边界的情况(末扇区部分写入) */
|
||||
else if ( cur_addr == addr_end_down ) {
|
||||
// 读取整个扇区原始数据
|
||||
read( cur_addr - FLASH_START_ADDR, read_sector_buf, FLASH_SECTOR_SIZE );
|
||||
|
||||
// 计算最大可写入长度(整个扇区)
|
||||
max_write_len = FLASH_SECTOR_SIZE;
|
||||
// 计算实际需要写入的长度(从扇区起始到结束地址)
|
||||
write_len = addr_end - cur_addr;
|
||||
write_len = write_len >= max_write_len ? max_write_len : write_len;
|
||||
|
||||
// 判断是否需要擦除
|
||||
if ( judge_whether_erase( read_sector_buf, write_len ) ) {
|
||||
// 需要擦除时:合并数据->擦除->写入整个扇区
|
||||
FAL_MEMCPY( read_sector_buf, buf, write_len );
|
||||
norflash_erase_sector( get_sector( cur_addr ) );
|
||||
write_sector( cur_addr, read_sector_buf, FLASH_SECTOR_SIZE );
|
||||
}
|
||||
else {
|
||||
// 直接写入数据
|
||||
write_sector( cur_addr, buf, write_len );
|
||||
}
|
||||
}
|
||||
/* 情况3:完整扇区写入(中间扇区) */
|
||||
else {
|
||||
// 直接擦除整个扇区(完整覆盖不需要保留数据)
|
||||
norflash_erase_sector( get_sector( cur_addr ) );
|
||||
// 写入整个扇区数据
|
||||
write_sector( cur_addr, buf, FLASH_SECTOR_SIZE );
|
||||
buf += FLASH_SECTOR_SIZE; // 移动数据指针
|
||||
}
|
||||
cur_addr += FLASH_SECTOR_SIZE; // 移动到下一个扇区
|
||||
}
|
||||
FAL_FREE( read_sector_buf ); // 释放缓冲区内存
|
||||
return size; // 返回成功写入的字节数
|
||||
}
|
||||
```
|
||||
关键逻辑说明:
|
||||
地址对齐处理:通过向上/向下对齐计算确定实际需要操作的扇区范围
|
||||
三种写入场景:
|
||||
首扇区部分写入:需要读取原始数据,合并新数据后判断擦除必要性
|
||||
中间完整扇区:直接擦除后全量写入,提高效率
|
||||
末扇区部分写入:处理方式类似首扇区,但数据位置不同
|
||||
擦除判断:通过judge_whether_erase函数检测是否需要执行擦除操作(基于NOR Flash的特性,只有需要将0变为1时才必须擦除)
|
||||
数据合并:使用临时缓冲区保存原始数据,仅修改需要写入的部分,最大限度减少擦除操作
|
||||
内存管理:动态分配扇区大小的缓冲区,处理完成后立即释放
|
||||
到这里 工作似乎做完了 但是 我们没有写入扇区的函数 只有页写入函数 norflash_write_page
|
||||
扇区写入逻辑和任意写入逻辑基本相同
|
||||
下面实现扇区写入函数
|
||||
```c
|
||||
/* 扇区写入函数:处理按页对齐的NOR Flash写入操作 */
|
||||
static int write_sector( long offset, const uint8_t* buf, size_t size )
|
||||
{
|
||||
// 计算实际物理地址(FLASH起始地址 + 偏移量)
|
||||
uint32_t addr = FLASH_START_ADDR + offset;
|
||||
|
||||
// 计算地址的页对齐上边界和下边界(按FLASH_PAGE_SIZE对齐)
|
||||
uint32_t addr_up = FAL_ALIGN_UP( addr, FLASH_PAGE_SIZE );
|
||||
uint32_t addr_down = FAL_ALIGN_DOWN( addr, FLASH_PAGE_SIZE );
|
||||
|
||||
// 计算写入结束地址及其页对齐边界
|
||||
uint32_t addr_end = addr + size;
|
||||
uint32_t addr_end_up = FAL_ALIGN_UP( addr_end, FLASH_PAGE_SIZE );
|
||||
uint32_t addr_end_down = FAL_ALIGN_DOWN( addr_end, FLASH_PAGE_SIZE );
|
||||
|
||||
// 初始化当前处理地址和长度变量
|
||||
uint32_t cur_addr = addr_down; // 从页对齐起始地址开始处理
|
||||
uint32_t max_write_len = 0; // 单次最大可写入长度
|
||||
uint32_t write_len = 0; // 实际写入长度
|
||||
|
||||
// 循环处理所有需要写入的页
|
||||
while ( cur_addr < addr_end_up ) {
|
||||
// 处理起始未对齐部分(跨页起始边界)
|
||||
if ( cur_addr < addr ) {
|
||||
// 计算当前页剩余可写空间(页结束地址 - 实际起始地址)
|
||||
max_write_len = ( addr_up - addr );
|
||||
// 取实际剩余长度和总长度的最小值
|
||||
write_len = size >= max_write_len ? max_write_len : size;
|
||||
|
||||
// 执行页写入:参数依次是数据指针、物理地址、写入长度
|
||||
norflash_write_page( buf, addr, write_len );
|
||||
buf += write_len; // 移动数据指针
|
||||
}
|
||||
// 处理结束未对齐部分(跨页结束边界)
|
||||
else if ( cur_addr == addr_end_down ) {
|
||||
// 单页最大写入长度
|
||||
max_write_len = FLASH_PAGE_SIZE;
|
||||
// 计算实际需要写入的长度(结束地址 - 当前页起始地址)
|
||||
write_len = addr_end - cur_addr;
|
||||
// 确保不超过页最大长度
|
||||
write_len = write_len >= max_write_len ? max_write_len : write_len;
|
||||
|
||||
// 执行页写入
|
||||
norflash_write_page( buf, cur_addr, write_len );
|
||||
}
|
||||
// 处理完整页写入
|
||||
else {
|
||||
// 整页写入(FLASH_PAGE_SIZE长度)
|
||||
norflash_write_page( buf, cur_addr, FLASH_PAGE_SIZE );
|
||||
buf += FLASH_PAGE_SIZE; // 移动数据指针整页长度
|
||||
}
|
||||
|
||||
// 移动到下一页起始地址
|
||||
cur_addr += FLASH_PAGE_SIZE;
|
||||
}
|
||||
return size; // 返回成功写入的总字节数
|
||||
}
|
||||
```
|
||||
至此 我们就完成了Flash驱动的移植 实现了读写擦除等操作 上面的思路对于大部分flash驱动来说是通用的
|
@ -6,8 +6,8 @@
|
||||
#define FLASH_END_ADDR 0x01000000U // 16*1024*1024
|
||||
|
||||
#define FLASH_PROGRAM_MIN_SIZE 256 // 256 bytes
|
||||
//每次对falsh写入时 底层可以写入的最大字节数为 FALSH_PAGE_SIZE
|
||||
#define FALSH_PAGE_SIZE FLASH_PROGRAM_MIN_SIZE // 256 bytes
|
||||
//每次对falsh写入时 底层可以写入的最大字节数为 FLASH_PAGE_SIZE
|
||||
#define FLASH_PAGE_SIZE FLASH_PROGRAM_MIN_SIZE // 256 bytes
|
||||
|
||||
/**
|
||||
* @brief 需要实现以下函数
|
||||
@ -71,12 +71,12 @@ static uint32_t judge_whether_erase( uint8_t* sector_buf, uint16_t len )
|
||||
static int write_sector( long offset, const uint8_t* buf, size_t size )
|
||||
{
|
||||
uint32_t addr = FLASH_START_ADDR + offset;
|
||||
uint32_t addr_up = FAL_ALIGN_UP( addr, FALSH_PAGE_SIZE );
|
||||
uint32_t addr_down = FAL_ALIGN_DOWN( addr, FALSH_PAGE_SIZE );
|
||||
uint32_t addr_up = FAL_ALIGN_UP( addr, FLASH_PAGE_SIZE );
|
||||
uint32_t addr_down = FAL_ALIGN_DOWN( addr, FLASH_PAGE_SIZE );
|
||||
|
||||
uint32_t addr_end = addr + size;
|
||||
uint32_t addr_end_up = FAL_ALIGN_UP( addr_end, FALSH_PAGE_SIZE );
|
||||
uint32_t addr_end_down = FAL_ALIGN_DOWN( addr_end, FALSH_PAGE_SIZE );
|
||||
uint32_t addr_end_up = FAL_ALIGN_UP( addr_end, FLASH_PAGE_SIZE );
|
||||
uint32_t addr_end_down = FAL_ALIGN_DOWN( addr_end, FLASH_PAGE_SIZE );
|
||||
|
||||
uint32_t cur_addr = addr_down;
|
||||
uint32_t max_write_len = 0;
|
||||
@ -89,17 +89,17 @@ static int write_sector( long offset, const uint8_t* buf, size_t size )
|
||||
buf += write_len;
|
||||
}
|
||||
else if ( cur_addr == addr_end_down ) {
|
||||
max_write_len = FALSH_PAGE_SIZE;
|
||||
max_write_len = FLASH_PAGE_SIZE;
|
||||
write_len = addr_end - cur_addr;
|
||||
write_len = write_len >= max_write_len ? max_write_len : write_len;
|
||||
norflash_write_page( buf, cur_addr, write_len );
|
||||
}
|
||||
else {
|
||||
norflash_write_page( buf, cur_addr, FALSH_PAGE_SIZE );
|
||||
buf += FALSH_PAGE_SIZE;
|
||||
norflash_write_page( buf, cur_addr, FLASH_PAGE_SIZE );
|
||||
buf += FLASH_PAGE_SIZE;
|
||||
}
|
||||
|
||||
cur_addr += FALSH_PAGE_SIZE;
|
||||
cur_addr += FLASH_PAGE_SIZE;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@ -118,7 +118,7 @@ static int write( long offset, const uint8_t* buf, size_t size )
|
||||
uint32_t write_len = 0;
|
||||
|
||||
if ( addr_end_up > FLASH_END_ADDR || ( int )addr_end_down < FLASH_START_ADDR ) return -1;
|
||||
//如果不使用内存分配可以定义一个static FLASH_SECTOR_SIZE 长度的buf
|
||||
//如果不使用内存分配可以定义一个static FLASH_SECTOR_SIZE 长度的buf
|
||||
uint8_t* read_sector_buf = FAL_MALLOC( FLASH_SECTOR_SIZE );
|
||||
if ( read_sector_buf == RT_NULL ) {
|
||||
return -2;
|
||||
|
@ -1634,7 +1634,7 @@ sysret_t sys_setpriority(int which, id_t who, int prio)
|
||||
for (list = lwp->t_grp.next; list != &lwp->t_grp; list = list->next)
|
||||
{
|
||||
thread = rt_list_entry(list, struct rt_thread, sibling);
|
||||
rt_thread_control(thread, RT_THREAD_CTRL_CHANGE_PRIORITY, &prio);
|
||||
rt_thread_control(thread, RT_THREAD_CTRL_RESET_PRIORITY, &prio);
|
||||
}
|
||||
lwp_pid_lock_release();
|
||||
return 0;
|
||||
@ -8789,7 +8789,7 @@ sysret_t sys_sched_setparam(pid_t tid, void *param)
|
||||
|
||||
if (thread)
|
||||
{
|
||||
ret = rt_thread_control(thread, RT_THREAD_CTRL_CHANGE_PRIORITY, (void *)&sched_param->sched_priority);
|
||||
ret = rt_thread_control(thread, RT_THREAD_CTRL_RESET_PRIORITY, (void *)&sched_param->sched_priority);
|
||||
}
|
||||
|
||||
lwp_tid_dec_ref(thread);
|
||||
@ -8959,7 +8959,7 @@ sysret_t sys_sched_setscheduler(int tid, int policy, void *param)
|
||||
}
|
||||
|
||||
thread = lwp_tid_get_thread_and_inc_ref(tid);
|
||||
ret = rt_thread_control(thread, RT_THREAD_CTRL_CHANGE_PRIORITY, (void *)&sched_param->sched_priority);
|
||||
ret = rt_thread_control(thread, RT_THREAD_CTRL_RESET_PRIORITY, (void *)&sched_param->sched_priority);
|
||||
lwp_tid_dec_ref(thread);
|
||||
|
||||
kmem_put(sched_param);
|
||||
|
142
rt-thread-no-bsp/documentation/0.doxygen/1.core.h
Normal file
142
rt-thread-no-bsp/documentation/0.doxygen/1.core.h
Normal file
@ -0,0 +1,142 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_kernel_core Kernel
|
||||
*
|
||||
* Core of RT-Thread, see @ref page_kernel_core for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup group_kernel_core
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_KernelObject Kernel Object Management
|
||||
* @brief See @ref section_kernel_object_model
|
||||
*
|
||||
* The Kernel object system can access and manage all of the kernel objects.
|
||||
*
|
||||
* Kernel objects include most of the facilities in the kernel:
|
||||
* - thread
|
||||
* - semaphore and mutex
|
||||
* - event/fast event, mailbox, messagequeue
|
||||
* - memory pool
|
||||
* - timer
|
||||
* @image html Kernel_Object.png "Figure 2: Kernel Object"
|
||||
* @image rtf Kernel_Object.png "Figure 2: Kernel Object"
|
||||
*
|
||||
* Kernel objects can be static objects, whose memory is allocated in compiling.
|
||||
* It can be dynamic objects as well, whose memory is allocated from system heaps
|
||||
* in runtime.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Thread Thread Management
|
||||
* @brief See @ref page_thread_management
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Clock Clock and Timer Management
|
||||
* @brief See @ref page_clock_management
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_IPC Inter-Thread Communication
|
||||
* @brief See @ref page_thread_comm
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_MM Memory Management
|
||||
* @brief memory management for memory pool and heap memory
|
||||
*
|
||||
* RT-Thread operating system supports two types memory management:
|
||||
* - Static memory pool management
|
||||
* - Dynamic memory heap management.
|
||||
*
|
||||
* The time to allocate a memory block from the memory pool is determinant. When
|
||||
* the memory pool is empty, the allocated thread can be blocked (or immediately return,
|
||||
* or waiting for sometime to return, which are determined by a timeout parameter).
|
||||
* When other thread releases memory blocks to this memory pool, the blocked thread is
|
||||
* wake up.
|
||||
*
|
||||
* There are two methods in dynamic memory heap management, one is used for small memory,
|
||||
* such as less than 1MB. Another is a SLAB like memory management, which is suitable
|
||||
* for large memory system. All of them has no real-time character.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Hook Runtime Trace and Record
|
||||
* @brief the hook function set in runtime
|
||||
*
|
||||
* In order to trace and record RT-Thread activity in runtime, a hook mechanism
|
||||
* is introduced.
|
||||
*
|
||||
* The hooks are a series of routines, which are invoked in some special checkpoints.
|
||||
* The hook routines include:
|
||||
* - object hook, invoked at object created, deleted, taken and put etc.
|
||||
* - scheduler hook, invoked at thread switch and idle thread loop.
|
||||
* - memory hook, invoked when allocate or free memory block.
|
||||
* - timer hook, invoked when timer is timeout.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_KernelService Other useful kernel service
|
||||
* @brief other useful service in the kernel
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Error Error Code
|
||||
* @brief error code
|
||||
*
|
||||
* The error code is defined to identify which kind of error occurs. When some
|
||||
* bad things happen, the current thread's errno will be set.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_SystemInit System Initialization
|
||||
*
|
||||
* @brief System initialization procedure.
|
||||
*
|
||||
* When RT-Thread operating system starts up, the basic operating system facility
|
||||
* initialization routines must be invoked.
|
||||
*
|
||||
* The suggested initialization sequence is:
|
||||
*
|
||||
* - initialize device hardware
|
||||
* rt_hw_board_init();
|
||||
*
|
||||
* User can put the low level hardware initialization in this function, such as
|
||||
* DDR memory setting, pinmux setting, console device setting etc.
|
||||
*
|
||||
* - show version
|
||||
* rt_show_version();
|
||||
*
|
||||
* - initialize timer system
|
||||
* rt_system_timer_init();
|
||||
*
|
||||
* - initialize system heap memory
|
||||
* rt_system_heap_init(__bss_end, __end_of_memory);
|
||||
*
|
||||
* - initialize module system
|
||||
* rt_system_module_init();
|
||||
*
|
||||
* - initialize scheduler system
|
||||
* rt_system_scheduler_init();
|
||||
*
|
||||
* - initialize application
|
||||
* rt_application_init();
|
||||
*
|
||||
* - initialize system timer thread
|
||||
* rt_system_timer_thread_init();
|
||||
*
|
||||
* - initialize idle thread
|
||||
* rt_thread_idle_init();
|
||||
*
|
||||
* - start scheduler
|
||||
* rt_system_scheduler_start();
|
||||
*/
|
||||
|
||||
/**@}*/
|
75
rt-thread-no-bsp/documentation/0.doxygen/2.components.h
Normal file
75
rt-thread-no-bsp/documentation/0.doxygen/2.components.h
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_kernel_components Components
|
||||
*
|
||||
* Components of RT-Thread, see @ref page_components for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup group_kernel_components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_DFS Device Virtual File System
|
||||
*
|
||||
* @brief DFS is a virtual file system in RT-Thread RTOS.
|
||||
*
|
||||
* The DFS (Device Virtual File System) is a vfs file system of RT-Thread RTOS,
|
||||
* which is focused on embedded device. VFS is an abstraction layer on top of a
|
||||
* more concrete file system. The purpose of a VFS is to allow client applications
|
||||
* to access different types of concrete file systems in a uniform way.
|
||||
*
|
||||
* @image html dfs.png "Figure 4: Device Virtual File System Architecture"
|
||||
*
|
||||
* The DFS specifies an interface between the kernel and a concrete file system.
|
||||
* Therefore, it is easy to add support for new file system types to the kernel
|
||||
* simply by fulfilling the interface.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Device Device System
|
||||
* @brief device I/O subsystem
|
||||
*
|
||||
* The Device System is designed as simple and minimum layer to help communication between
|
||||
* applications and drivers.
|
||||
*
|
||||
* The Device System provide five interfaces to driver:
|
||||
* - open, open a device
|
||||
* - close, close a device
|
||||
* - read, read some data from a device
|
||||
* - write, write some data to a device
|
||||
* - control, send some control command to a device
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_finsh finsh shell
|
||||
*
|
||||
* @brief finsh shell is a user command shell in RT-Thread RTOS.
|
||||
*
|
||||
* finsh shell is a user command shell in RT-Thread RTOS, which is a shell can
|
||||
* accept C-expression like syntax in command. From finsh shell, user can access
|
||||
* system area, such as memory, variables and function by input C-expression in
|
||||
* command.
|
||||
*
|
||||
* @image html finsh.png "Figure 3: finsh shell architecture"
|
||||
* There is a shell thread, which named as "tshell", in the finsh shell, it read
|
||||
* user command from console device, and then invokes system function or access
|
||||
* system variable to output result (by rt_kprintf).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Module Application Module
|
||||
*
|
||||
* @brief Application Module is a feature let user to execute application in RT-Thread RTOS.
|
||||
*
|
||||
* Application Module is implemented as dynamic object loader, but it can handle
|
||||
* the dependences relationship between application and dynamic library, moreover,
|
||||
* it also can handle the kernel object destroy and memory release issue when application
|
||||
* (abnormally) exit.
|
||||
*/
|
||||
|
||||
/**@}*/
|
@ -6,4 +6,6 @@
|
||||
* @defgroup group_doxygen_example Doxygen Example
|
||||
*
|
||||
* @brief Introduce how to write doxygen documentation.
|
||||
*
|
||||
* See @ref page_howto_doxygen for more details.
|
||||
*/
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup group_DFS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Fd File Descriptor
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_FsApi File System API
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_FileApi File API
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_FsPosixApi File POSIX API
|
||||
*/
|
||||
|
||||
/**@}*/
|
19
rt-thread-no-bsp/documentation/0.doxygen/core/ipc.h
Normal file
19
rt-thread-no-bsp/documentation/0.doxygen/core/ipc.h
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup group_IPC
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Signal Signal
|
||||
* @brief signal is used for thread kill etc.
|
||||
*
|
||||
* A signal (also known as a soft interrupt signal), from a software perspective,
|
||||
* is a simulation of interrupt mechanism. When it comes to its principle,
|
||||
* thread receiving a signal is similar to processor receiving an interrupt request.
|
||||
*/
|
||||
|
||||
/**@}*/
|
19
rt-thread-no-bsp/documentation/0.doxygen/core/systeminit.h
Normal file
19
rt-thread-no-bsp/documentation/0.doxygen/core/systeminit.h
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup group_SystemInit
|
||||
*
|
||||
* This function will initialize user application.
|
||||
*
|
||||
* This function will be invoked when system initialization and system scheduler
|
||||
* has not started. User can allocate memory, create thread, semaphore etc. However,
|
||||
* user shall not suspend 'current' thread.
|
||||
*/
|
||||
void rt_application_init();
|
||||
|
||||
/**
|
||||
* @ingroup group_SystemInit
|
||||
*/
|
||||
void rt_system_heap_init(void* begin_addr, void* end_addr);
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_DFS Device Virtual File System
|
||||
*
|
||||
* @brief DFS is a virtual file system in RT-Thread RTOS.
|
||||
*
|
||||
* The DFS (Device Virtual File System) is a vfs file system of RT-Thread RTOS,
|
||||
* which is focused on embedded device. VFS is an abstraction layer on top of a
|
||||
* more concrete file system. The purpose of a VFS is to allow client applications
|
||||
* to access different types of concrete file systems in a uniform way.
|
||||
*
|
||||
* @image html dfs.png "Figure 4: Device Virtual File System Architecture"
|
||||
*
|
||||
* The DFS specifies an interface between the kernel and a concrete file system.
|
||||
* Therefore, it is easy to add support for new file system types to the kernel
|
||||
* simply by fulfilling the interface.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup group_DFS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Fd File Descriptor
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_FsApi File System API
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_FileApi File API
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_FsPosixApi File POSIX API
|
||||
*/
|
||||
|
||||
/**@}*/
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_finsh finsh shell
|
||||
*
|
||||
* @brief finsh shell is a user command shell in RT-Thread RTOS.
|
||||
*
|
||||
* finsh shell is a user command shell in RT-Thread RTOS, which is a shell can
|
||||
* accept C-expression like syntax in command. From finsh shell, user can access
|
||||
* system area, such as memory, variables and function by input C-expression in
|
||||
* command.
|
||||
*
|
||||
* @image html finsh.png "Figure 3: finsh shell architecture"
|
||||
* There is a shell thread, which named as "tshell", in the finsh shell, it read
|
||||
* user command from console device, and then invokes system function or access
|
||||
* system variable to output result (by rt_kprintf).
|
||||
*/
|
@ -1,169 +0,0 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Kernel RT-Thread Kernel API
|
||||
*
|
||||
* The Kernel APIs are the core APIs of RT-Thread, which supports the following
|
||||
* features:
|
||||
* - Multi-thread management
|
||||
* - Synchronization mechanisms
|
||||
* - Inter-thread communication
|
||||
* - Memory management
|
||||
* - Asynchronous timer
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup group_Kernel
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Thread Thread Management
|
||||
* @brief the thread management
|
||||
*
|
||||
* RT-Thread operating system supports multitask systems, which are based on thread
|
||||
* scheduling.
|
||||
* - The scheduling is a full preemptive priority-based scheduling algorithm.
|
||||
* - 8/32/256 priority levels are supported, in which 0 is the highest and 7/31/255 the lowest.
|
||||
* The 7/31/255th priority is used for idle thread.
|
||||
* - Threads running at same priority level are supported. The shared time-slice
|
||||
* round-robin scheduling is used for this case.
|
||||
* - The time of scheduler to choose the next highest ready thread is determinant.
|
||||
* - There are four status in thread management
|
||||
* -# Initialization
|
||||
* -# Running/Ready
|
||||
* -# Blocked
|
||||
* -# Closed
|
||||
* - The number of threads in the system is unlimited, only related with RAM.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Clock Clock and Timer Management
|
||||
* @brief clock and system timer management
|
||||
*
|
||||
* RT-Thread uses clock tick to implement shared time-slice scheduling.
|
||||
*
|
||||
* The timing sensitivity of thread is implemented by timers. The timer can be set as
|
||||
* one-shot or periodic timeout.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_KernelObject Kernel Object Management
|
||||
* @brief kernel object management
|
||||
*
|
||||
* The Kernel object system can access and manage all of the kernel objects.
|
||||
*
|
||||
* Kernel objects include most of the facilities in the kernel:
|
||||
* - thread
|
||||
* - semaphore and mutex
|
||||
* - event/fast event, mailbox, messagequeue
|
||||
* - memory pool
|
||||
* - timer
|
||||
* @image html Kernel_Object.png "Figure 2: Kernel Object"
|
||||
* @image rtf Kernel_Object.png "Figure 2: Kernel Object"
|
||||
*
|
||||
* Kernel objects can be static objects, whose memory is allocated in compiling.
|
||||
* It can be dynamic objects as well, whose memory is allocated from system heaps
|
||||
* in runtime.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_IPC Inter-Thread Communication
|
||||
* @brief inter-thread communication
|
||||
*
|
||||
* RT-Thread operating system supports the traditional semaphore and mutex.
|
||||
* - Mutex objects use inherited priority to prevent priority reversion.
|
||||
* - The semaphore release action is safe for interrupt service routine.
|
||||
*
|
||||
* Moreover, the blocked queue for thread to obtain semaphore or mutex can be sorted
|
||||
* by priority or FIFO. There are two flags to indicate this mechanism.
|
||||
* - RT_IPC_FLAG_FIFO
|
||||
* when the resource is available, thread pended on this resource at first would get
|
||||
* the resource.
|
||||
* - RT_IPC_FLAG_PRIO
|
||||
* when the resource is available, thread pended on this resource who had the most high
|
||||
* priority would get the resource.
|
||||
*
|
||||
* RT-Thread operating systems supports event/fast event, mail box and message queue.
|
||||
* - The event mechanism is used to awake a thread by setting one or more corresponding
|
||||
* bit of a binary number when an event ocurs.
|
||||
* - The fast event supports event thread queue. Once a one bit event occurs, the corresponding
|
||||
* blocked thread can be found out timing accurately, then will be waked up.
|
||||
* - In mailbox, the mail length is fixed to 4 byte, which is more effective than message queue.
|
||||
* - The send action for communication facilities is also safe for interrupt service routine.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Signal Signal
|
||||
* @brief signal is used for thread kill etc.
|
||||
*
|
||||
* A signal (also known as a soft interrupt signal), from a software perspective,
|
||||
* is a simulation of interrupt mechanism. When it comes to its principle,
|
||||
* thread receiving a signal is similar to processor receiving an interrupt request.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_MM Memory Management
|
||||
* @brief memory management for memory pool and heap memory
|
||||
*
|
||||
* RT-Thread operating system supports two types memory management:
|
||||
* - Static memory pool management
|
||||
* - Dynamic memory heap management.
|
||||
*
|
||||
* The time to allocate a memory block from the memory pool is determinant. When
|
||||
* the memory pool is empty, the allocated thread can be blocked (or immediately return,
|
||||
* or waiting for sometime to return, which are determined by a timeout parameter).
|
||||
* When other thread releases memory blocks to this memory pool, the blocked thread is
|
||||
* wake up.
|
||||
*
|
||||
* There are two methods in dynamic memory heap management, one is used for small memory,
|
||||
* such as less than 1MB. Another is a SLAB like memory management, which is suitable
|
||||
* for large memory system. All of them has no real-time character.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Device Device System
|
||||
* @brief device I/O subsystem
|
||||
*
|
||||
* The Device System is designed as simple and minimum layer to help communication between
|
||||
* applications and drivers.
|
||||
*
|
||||
* The Device System provide five interfaces to driver:
|
||||
* - open, open a device
|
||||
* - close, close a device
|
||||
* - read, read some data from a device
|
||||
* - write, write some data to a device
|
||||
* - control, send some control command to a device
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Hook Runtime Trace and Record
|
||||
* @brief the hook function set in runtime
|
||||
*
|
||||
* In order to trace and record RT-Thread activity in runtime, a hook mechanism
|
||||
* is introduced.
|
||||
*
|
||||
* The hooks are a series of routines, which are invoked in some special checkpoints.
|
||||
* The hook routines include:
|
||||
* - object hook, invoked at object created, deleted, taken and put etc.
|
||||
* - scheduler hook, invoked at thread switch and idle thread loop.
|
||||
* - memory hook, invoked when allocate or free memory block.
|
||||
* - timer hook, invoked when timer is timeout.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_KernelService Other useful kernel service
|
||||
* @brief other useful service in the kernel
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Error Error Code
|
||||
* @brief error code
|
||||
*
|
||||
* The error code is defined to identify which kind of error occurs. When some
|
||||
* bad things happen, the current thread's errno will be set.
|
||||
*/
|
||||
|
||||
/**@}*/
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @mainpage Introduction
|
||||
* @author RT-Thread Development Team
|
||||
* @version 1.2.0
|
||||
*
|
||||
* RT-Thread RTOS is an open source embedded real-time operating system and is
|
||||
* designed specifically for small memory footprint platforms. The real-time and
|
||||
* embedded characters are the most significant advantages of RT-Thread.
|
||||
*
|
||||
* - Real-Time Character
|
||||
*
|
||||
* RT-Thread has a real-time operating system kernel, with fully preempted
|
||||
* multi-thread scheduler, inter-thread communication with timing sensitivity
|
||||
* and transparent interrupt handling.
|
||||
*
|
||||
* - Embedded Character
|
||||
*
|
||||
* RT-Thread is suitable for embedded systems for small footprint characters.
|
||||
* The kernel is implemented as a simple C library. The simplest application
|
||||
* costs less than 1 Kbytes RAM on the ARM Cortex-M platform.
|
||||
*
|
||||
* @section kernel_arch RT-Thread Architecture
|
||||
*
|
||||
* RT-Thread system architecture is like:
|
||||
* @image html System_Arch.png "Figure 1: RT-Thread Architecture"
|
||||
*
|
||||
* @section kernel_service Kernel API
|
||||
*
|
||||
* The Kernel APIs are the core APIs of RT-Thread, which supports the following
|
||||
* features:
|
||||
* - Multi-thread management and scheduler
|
||||
* - Synchronization mechanisms, semaphore, recursive mutex and event set
|
||||
* - Inter-thread communication, mailbox and message queue
|
||||
* - Memory management, memory pool and dynamic heap memory management
|
||||
* - Asynchronous timer
|
||||
*
|
||||
* For more details, please refer to @ref group_Kernel
|
||||
*
|
||||
* @section system_init System Initialization
|
||||
*
|
||||
* Once RT-Thread operating system starts up, the facility in system must be initialized
|
||||
* firstly.
|
||||
*
|
||||
* For more details, please refer to @ref group_SystemInit
|
||||
*/
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_Module Application Module
|
||||
*
|
||||
* @brief Application Module is a feature let user to execute application in RT-Thread RTOS.
|
||||
*
|
||||
* Application Module is implemented as dynamic object loader, but it can handle
|
||||
* the dependences relationship between application and dynamic library, moreover,
|
||||
* it also can handle the kernel object destroy and memory release issue when application
|
||||
* (abnormally) exit.
|
||||
*/
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* This file is only used for doxygen document generation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup group_SystemInit System Initialization
|
||||
*
|
||||
* @brief System initialization procedure.
|
||||
*
|
||||
* When RT-Thread operating system starts up, the basic operating system facility
|
||||
* initialization routines must be invoked.
|
||||
*
|
||||
* The suggested initialization sequence is:
|
||||
*
|
||||
* - initialize device hardware
|
||||
* rt_hw_board_init();
|
||||
*
|
||||
* User can put the low level hardware initialization in this function, such as
|
||||
* DDR memory setting, pinmux setting, console device setting etc.
|
||||
*
|
||||
* - show version
|
||||
* rt_show_version();
|
||||
*
|
||||
* - initialize timer system
|
||||
* rt_system_timer_init();
|
||||
*
|
||||
* - initialize system heap memory
|
||||
* rt_system_heap_init(__bss_end, __end_of_memory);
|
||||
*
|
||||
* - initialize module system
|
||||
* rt_system_module_init();
|
||||
*
|
||||
* - initialize scheduler system
|
||||
* rt_system_scheduler_init();
|
||||
*
|
||||
* - initialize application
|
||||
* rt_application_init();
|
||||
*
|
||||
* - initialize system timer thread
|
||||
* rt_system_timer_thread_init();
|
||||
*
|
||||
* - initialize idle thread
|
||||
* rt_thread_idle_init();
|
||||
*
|
||||
* - start scheduler
|
||||
* rt_system_scheduler_start();
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup group_SystemInit
|
||||
*
|
||||
* This function will initialize user application.
|
||||
*
|
||||
* This function will be invoked when system initialization and system scheduler
|
||||
* has not started. User can allocate memory, create thread, semaphore etc. However,
|
||||
* user shall not suspend 'current' thread.
|
||||
*/
|
||||
void rt_application_init();
|
||||
|
||||
/**
|
||||
* @ingroup group_SystemInit
|
||||
*/
|
||||
void rt_system_heap_init(void* begin_addr, void* end_addr);
|
@ -1,4 +1,4 @@
|
||||
@page page_kernel Kenrel
|
||||
@page page_kernel_core Kernel
|
||||
|
||||
- @subpage page_kernel_basics
|
||||
- @subpage page_thread_management
|
||||
|
@ -295,7 +295,7 @@ The macro interface definitions used to implement the automatic initialization f
|
||||
|
||||
Initialization function actively declares through these macro interfaces, such as `INIT_BOARD_EXPORT(rt_hw_usart_init)`, the linker will automatically collect all the declared initialization functions, placed in the RTI symbol segment, the symbol segment is located in the RO segment of the memory distribution. All functions in this RTI symbol segment are automatically called when the system is initialized.
|
||||
|
||||
# RT-Thread Kernel Object Model
|
||||
@section section_kernel_object_model RT-Thread Kernel Object Model
|
||||
|
||||
## Static and Dynamic Objects
|
||||
|
||||
|
@ -2241,7 +2241,8 @@ PREDEFINED = RT_USING_SEMAPHORE \
|
||||
FINSH_USING_DESCRIPTION \
|
||||
RT_USING_FINSH \
|
||||
RT_USING_HEAP \
|
||||
RT_USING_MODULE
|
||||
RT_USING_MODULE \
|
||||
RT_USING_SIGNALS
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
@subpage page_quick_start
|
||||
|
||||
@subpage page_kernel
|
||||
@subpage page_kernel_core
|
||||
|
||||
- @ref page_kernel_basics
|
||||
- @ref page_thread_management
|
||||
|
@ -251,6 +251,7 @@ typedef int (*init_fn_t)(void);
|
||||
* @def RT_ALIGN(size, align)
|
||||
* Return the most contiguous size aligned at specified width. RT_ALIGN(13, 4)
|
||||
* would return 16.
|
||||
* @note align Must be an integer power of 2 or the result will be incorrect
|
||||
*/
|
||||
#define RT_ALIGN(size, align) (((size) + (align) - 1) & ~((align) - 1))
|
||||
|
||||
@ -260,6 +261,7 @@ typedef int (*init_fn_t)(void);
|
||||
* @def RT_ALIGN_DOWN(size, align)
|
||||
* Return the down number of aligned at specified width. RT_ALIGN_DOWN(13, 4)
|
||||
* would return 12.
|
||||
* @note align Must be an integer power of 2 or the result will be incorrect
|
||||
*/
|
||||
#define RT_ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
|
||||
|
||||
@ -540,7 +542,7 @@ struct rt_object_information
|
||||
#define RT_TIMER_CTRL_GET_FUNC 0x6 /**< get timer timeout func */
|
||||
#define RT_TIMER_CTRL_SET_FUNC 0x7 /**< set timer timeout func */
|
||||
#define RT_TIMER_CTRL_GET_PARM 0x8 /**< get timer parameter */
|
||||
#define RT_TIMER_CTRL_SET_PARM 0x9 /**< get timer parameter */
|
||||
#define RT_TIMER_CTRL_SET_PARM 0x9 /**< set timer parameter */
|
||||
|
||||
#ifndef RT_TIMER_SKIP_LIST_LEVEL
|
||||
#define RT_TIMER_SKIP_LIST_LEVEL 1
|
||||
@ -643,6 +645,7 @@ enum
|
||||
#define RT_THREAD_CTRL_CHANGE_PRIORITY 0x02 /**< Change thread priority. */
|
||||
#define RT_THREAD_CTRL_INFO 0x03 /**< Get thread information. */
|
||||
#define RT_THREAD_CTRL_BIND_CPU 0x04 /**< Set thread bind cpu. */
|
||||
#define RT_THREAD_CTRL_RESET_PRIORITY 0x05 /**< Reset thread priority. */
|
||||
|
||||
/**
|
||||
* CPU usage statistics data
|
||||
|
@ -129,6 +129,7 @@ rt_err_t rt_sched_thread_close(struct rt_thread *thread);
|
||||
rt_err_t rt_sched_thread_ready(struct rt_thread *thread);
|
||||
rt_err_t rt_sched_thread_suspend(struct rt_thread *thread, rt_sched_lock_level_t level);
|
||||
rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t priority);
|
||||
rt_err_t rt_sched_thread_reset_priority(struct rt_thread *thread, rt_uint8_t priority);
|
||||
rt_err_t rt_sched_thread_bind_cpu(struct rt_thread *thread, int cpu);
|
||||
rt_uint8_t rt_sched_thread_is_suspended(struct rt_thread *thread);
|
||||
rt_err_t rt_sched_thread_timer_stop(struct rt_thread *thread);
|
||||
|
@ -1,6 +1,7 @@
|
||||
# RT-Thread building script for bridge
|
||||
|
||||
import os
|
||||
import re
|
||||
from building import *
|
||||
|
||||
Import('rtconfig')
|
||||
@ -24,4 +25,12 @@ group = group + SConscript(os.path.join('common', 'SConscript'))
|
||||
if rtconfig.CPU != 'common':
|
||||
group = group + SConscript(os.path.join(rtconfig.CPU, 'SConscript'))
|
||||
|
||||
def del_gnu99():
|
||||
for g in Projects:
|
||||
if g["name"] == "Kernel":
|
||||
flags = re.sub(r'\s+', ' ', re.sub(r'\s*-std=gnu99\s*', ' ', g["LOCAL_CFLAGS"])).strip()
|
||||
flags = re.sub(r'(?<!\s)(-Wunused)', r' \1', flags)
|
||||
g["LOCAL_CFLAGS"] = flags
|
||||
|
||||
RegisterPreBuildingAction(del_gnu99)
|
||||
Return('group')
|
||||
|
@ -115,8 +115,6 @@ void *rt_hw_mmu_map(struct rt_aspace *aspace, void *v_addr, void *p_addr,
|
||||
void rt_hw_mmu_unmap(struct rt_aspace *aspace, void *v_addr, size_t size);
|
||||
void rt_hw_aspace_switch(struct rt_aspace *aspace);
|
||||
void *rt_hw_mmu_v2p(struct rt_aspace *aspace, void *vaddr);
|
||||
void rt_hw_mmu_kernel_map_init(struct rt_aspace *aspace, rt_size_t vaddr_start,
|
||||
rt_size_t size);
|
||||
void *rt_hw_mmu_pgtbl_create(void);
|
||||
void rt_hw_mmu_pgtbl_delete(void *pgtbl);
|
||||
void *rt_hw_mmu_tbl_get(void);
|
||||
|
@ -474,7 +474,7 @@ void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr)
|
||||
attr = MMU_MAP_K_RWCB;
|
||||
break;
|
||||
case NORMAL_NOCACHE_MEM:
|
||||
attr = MMU_MAP_K_RWCB;
|
||||
attr = MMU_MAP_K_RW;
|
||||
break;
|
||||
case DEVICE_MEM:
|
||||
attr = MMU_MAP_K_DEVICE;
|
||||
|
@ -121,7 +121,6 @@ void rt_hw_aspace_switch(struct rt_aspace *aspace);
|
||||
void rt_hw_mmu_switch(void *tbl);
|
||||
|
||||
void *rt_hw_mmu_v2p(struct rt_aspace *aspace, void *vaddr);
|
||||
void rt_hw_mmu_kernel_map_init(struct rt_aspace *aspace, size_t vaddr_start, size_t size);
|
||||
void *rt_hw_mmu_tbl_get(void);
|
||||
|
||||
int rt_hw_mmu_control(struct rt_aspace *aspace, void *vaddr, size_t size, enum rt_mmu_cntl cmd);
|
||||
|
@ -648,6 +648,8 @@ void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr)
|
||||
|
||||
#define SATP_BASE ((rt_ubase_t)SATP_MODE << SATP_MODE_OFFSET)
|
||||
|
||||
extern unsigned int __bss_end;
|
||||
|
||||
/**
|
||||
* @brief Early memory setup function for hardware initialization.
|
||||
*
|
||||
|
@ -60,8 +60,6 @@ void *rt_hw_mmu_tbl_get(void);
|
||||
int rt_hw_mmu_map_init(rt_aspace_t aspace, void *v_address, rt_ubase_t size,
|
||||
rt_ubase_t *vtable, rt_ubase_t pv_off);
|
||||
void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr);
|
||||
void rt_hw_mmu_kernel_map_init(rt_aspace_t aspace, rt_ubase_t vaddr_start,
|
||||
rt_ubase_t size);
|
||||
void *rt_hw_mmu_map(rt_aspace_t aspace, void *v_addr, void *p_addr, size_t size,
|
||||
size_t attr);
|
||||
void rt_hw_mmu_unmap(rt_aspace_t aspace, void *v_addr, size_t size);
|
||||
|
@ -59,7 +59,7 @@ void rt_interrupt_leave_sethook(void (*hook)(void))
|
||||
#endif /* RT_USING_HOOK */
|
||||
|
||||
/**
|
||||
* @addtogroup group_Kernel
|
||||
* @addtogroup group_kernel_core
|
||||
*/
|
||||
|
||||
/**@{*/
|
||||
|
@ -180,7 +180,7 @@ rt_err_t rt_sched_tick_increase(rt_tick_t tick)
|
||||
/**
|
||||
* @brief Update priority of the target thread
|
||||
*/
|
||||
rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t priority)
|
||||
static rt_err_t _rt_sched_update_priority(struct rt_thread *thread, rt_uint8_t priority, rt_bool_t update_init_prio)
|
||||
{
|
||||
RT_ASSERT(priority < RT_THREAD_PRIORITY_MAX);
|
||||
RT_SCHED_DEBUG_IS_LOCKED;
|
||||
@ -192,6 +192,10 @@ rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t pr
|
||||
rt_sched_remove_thread(thread);
|
||||
|
||||
/* change thread priority */
|
||||
if (update_init_prio)
|
||||
{
|
||||
RT_SCHED_PRIV(thread).init_priority = priority;
|
||||
}
|
||||
RT_SCHED_PRIV(thread).current_priority = priority;
|
||||
|
||||
/* recalculate priority attribute */
|
||||
@ -209,6 +213,10 @@ rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t pr
|
||||
}
|
||||
else
|
||||
{
|
||||
if (update_init_prio)
|
||||
{
|
||||
RT_SCHED_PRIV(thread).init_priority = priority;
|
||||
}
|
||||
RT_SCHED_PRIV(thread).current_priority = priority;
|
||||
|
||||
/* recalculate priority attribute */
|
||||
@ -224,6 +232,22 @@ rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t pr
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update priority of the target thread
|
||||
*/
|
||||
rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t priority)
|
||||
{
|
||||
return _rt_sched_update_priority(thread, priority, RT_FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset priority of the target thread
|
||||
*/
|
||||
rt_err_t rt_sched_thread_reset_priority(struct rt_thread *thread, rt_uint8_t priority)
|
||||
{
|
||||
return _rt_sched_update_priority(thread, priority, RT_TRUE);
|
||||
}
|
||||
|
||||
#ifdef RT_USING_OVERFLOW_CHECK
|
||||
void rt_scheduler_stack_check(struct rt_thread *thread)
|
||||
{
|
||||
|
@ -779,6 +779,8 @@ RTM_EXPORT(rt_thread_mdelay);
|
||||
*
|
||||
* RT_THREAD_CTRL_BIND_CPU for bind the thread to a CPU.
|
||||
*
|
||||
* RT_THREAD_CTRL_RESET_PRIORITY for reset priority level of thread.
|
||||
*
|
||||
* @param arg is the argument of control command.
|
||||
*
|
||||
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
|
||||
@ -802,6 +804,16 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
|
||||
return error;
|
||||
}
|
||||
|
||||
case RT_THREAD_CTRL_RESET_PRIORITY:
|
||||
{
|
||||
rt_err_t error;
|
||||
rt_sched_lock_level_t slvl;
|
||||
rt_sched_lock(&slvl);
|
||||
error = rt_sched_thread_reset_priority(thread, *(rt_uint8_t *)arg);
|
||||
rt_sched_unlock(slvl);
|
||||
return error;
|
||||
}
|
||||
|
||||
case RT_THREAD_CTRL_STARTUP:
|
||||
{
|
||||
return rt_thread_startup(thread);
|
||||
|
@ -1,3 +1,17 @@
|
||||
#
|
||||
# Copyright (c) 2025, RT-Thread Development Team
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Change Logs:
|
||||
# Date Author Notes
|
||||
# 2025-04-21 supperthomas add the smart yml support and add env
|
||||
#
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import re
|
||||
@ -36,7 +50,7 @@ def run_cmd(cmd, output_info=True):
|
||||
return output_str_list, res
|
||||
|
||||
|
||||
def build_bsp(bsp, scons_args='',name='default'):
|
||||
def build_bsp(bsp, scons_args='',name='default', pre_build_commands=None, post_build_command=None,build_check_result = None,bsp_build_env=None):
|
||||
"""
|
||||
build bsp.
|
||||
|
||||
@ -56,21 +70,41 @@ def build_bsp(bsp, scons_args='',name='default'):
|
||||
|
||||
"""
|
||||
success = True
|
||||
# 设置环境变量
|
||||
if bsp_build_env is not None:
|
||||
print("Setting environment variables:")
|
||||
for key, value in bsp_build_env.items():
|
||||
print(f"{key}={value}")
|
||||
os.environ[key] = value # 设置环境变量
|
||||
os.chdir(rtt_root)
|
||||
os.makedirs(f'{rtt_root}/output/bsp/{bsp}', exist_ok=True)
|
||||
if os.path.exists(f"{rtt_root}/bsp/{bsp}/Kconfig"):
|
||||
os.chdir(rtt_root)
|
||||
run_cmd(f'scons -C bsp/{bsp} --pyconfig-silent', output_info=False)
|
||||
run_cmd(f'scons -C bsp/{bsp} --pyconfig-silent', output_info=True)
|
||||
|
||||
os.chdir(f'{rtt_root}/bsp/{bsp}')
|
||||
run_cmd('pkgs --update-force', output_info=False)
|
||||
run_cmd('pkgs --update-force', output_info=True)
|
||||
run_cmd('pkgs --list')
|
||||
|
||||
nproc = multiprocessing.cpu_count()
|
||||
if pre_build_commands is not None:
|
||||
print("Pre-build commands:")
|
||||
print(pre_build_commands)
|
||||
for command in pre_build_commands:
|
||||
print(command)
|
||||
output, returncode = run_cmd(command, output_info=True)
|
||||
print(output)
|
||||
if returncode != 0:
|
||||
print(f"Pre-build command failed: {command}")
|
||||
print(output)
|
||||
os.chdir(rtt_root)
|
||||
# scons 编译命令
|
||||
cmd = f'scons -C bsp/{bsp} -j{nproc} {scons_args}' # --debug=time for debug time
|
||||
__, res = run_cmd(cmd, output_info=True)
|
||||
|
||||
output, res = run_cmd(cmd, output_info=True)
|
||||
if build_check_result is not None:
|
||||
if res != 0 or not check_output(output, build_check_result):
|
||||
print("Build failed or build check result not found")
|
||||
print(output)
|
||||
if res != 0:
|
||||
success = False
|
||||
else:
|
||||
@ -83,6 +117,13 @@ def build_bsp(bsp, scons_args='',name='default'):
|
||||
shutil.copy(file, f'{rtt_root}/output/bsp/{bsp}/{name.replace("/", "_")}.{file_type[2:]}')
|
||||
|
||||
os.chdir(f'{rtt_root}/bsp/{bsp}')
|
||||
if post_build_command is not None:
|
||||
for command in post_build_command:
|
||||
output, returncode = run_cmd(command, output_info=True)
|
||||
print(output)
|
||||
if returncode != 0:
|
||||
print(f"Post-build command failed: {command}")
|
||||
print(output)
|
||||
run_cmd('scons -c', output_info=False)
|
||||
|
||||
return success
|
||||
@ -158,7 +199,17 @@ def build_bsp_attachconfig(bsp, attach_file):
|
||||
|
||||
return res
|
||||
|
||||
def check_output(output, check_string):
|
||||
"""检查输出中是否包含指定字符串"""
|
||||
output_str = ''.join(output) if isinstance(output, list) else str(output)
|
||||
flag = check_string in output_str
|
||||
if flag == True:
|
||||
print('Success: find string ' + check_string)
|
||||
else:
|
||||
print(output)
|
||||
print(f"::error:: can not find string {check_string} output: {output_str}")
|
||||
|
||||
return flag
|
||||
if __name__ == "__main__":
|
||||
"""
|
||||
build all bsp and attach config.
|
||||
@ -169,10 +220,12 @@ if __name__ == "__main__":
|
||||
"""
|
||||
failed = 0
|
||||
count = 0
|
||||
ci_build_run_flag = False
|
||||
qemu_timeout_second = 50
|
||||
|
||||
rtt_root = os.getcwd()
|
||||
srtt_bsp = os.getenv('SRTT_BSP').split(',')
|
||||
|
||||
print(srtt_bsp)
|
||||
for bsp in srtt_bsp:
|
||||
count += 1
|
||||
print(f"::group::Compiling BSP: =={count}=== {bsp} ====")
|
||||
@ -207,26 +260,80 @@ if __name__ == "__main__":
|
||||
continue
|
||||
|
||||
config_file = os.path.join(rtt_root, 'bsp', bsp, '.config')
|
||||
|
||||
# 在使用 pre_build_commands 之前,确保它被定义
|
||||
pre_build_commands = None
|
||||
build_command = None
|
||||
post_build_command = None
|
||||
qemu_command = None
|
||||
build_check_result = None
|
||||
commands = None
|
||||
check_result = None
|
||||
bsp_build_env = None
|
||||
for projects in yml_files_content:
|
||||
for name, details in projects.items():
|
||||
# 如果是bsp_board_info,读取基本的信息
|
||||
if(name == 'bsp_board_info'):
|
||||
print(details)
|
||||
pre_build_commands = details.get("pre_build").splitlines()
|
||||
build_command = details.get("build_cmd").splitlines()
|
||||
post_build_command = details.get("post_build").splitlines()
|
||||
qemu_command = details.get("run_cmd")
|
||||
|
||||
if details.get("kconfig") is not None:
|
||||
if details.get("buildcheckresult") is not None:
|
||||
build_check_result = details.get("buildcheckresult")
|
||||
else:
|
||||
build_check_result = None
|
||||
if details.get("msh_cmd") is not None:
|
||||
commands = details.get("msh_cmd").splitlines()
|
||||
else:
|
||||
msh_cmd = None
|
||||
if details.get("checkresult") is not None:
|
||||
check_result = details.get("checkresult")
|
||||
else:
|
||||
check_result = None
|
||||
if details.get("ci_build_run_flag") is not None:
|
||||
ci_build_run_flag = details.get("ci_build_run_flag")
|
||||
else:
|
||||
ci_build_run_flag = None
|
||||
if details.get("pre_build") is not None:
|
||||
pre_build_commands = details.get("pre_build").splitlines()
|
||||
if details.get("env") is not None:
|
||||
bsp_build_env = details.get("env")
|
||||
else:
|
||||
bsp_build_env = None
|
||||
if details.get("build_cmd") is not None:
|
||||
build_command = details.get("build_cmd").splitlines()
|
||||
else:
|
||||
build_command = None
|
||||
if details.get("post_build") is not None:
|
||||
post_build_command = details.get("post_build").splitlines()
|
||||
if details.get("run_cmd") is not None:
|
||||
qemu_command = details.get("run_cmd")
|
||||
else:
|
||||
qemu_command = None
|
||||
count += 1
|
||||
config_bacakup = config_file+'.origin'
|
||||
shutil.copyfile(config_file, config_bacakup)
|
||||
#加载yml中的配置放到.config文件
|
||||
with open(config_file, 'a') as destination:
|
||||
if details.get("kconfig") is None:
|
||||
#如果没有Kconfig,读取下一个配置
|
||||
continue
|
||||
if(projects.get(name) is not None):
|
||||
# 获取Kconfig中所有的信息
|
||||
detail_list=get_details_and_dependencies([name],projects)
|
||||
for line in detail_list:
|
||||
destination.write(line + '\n')
|
||||
scons_arg=[]
|
||||
#如果配置中有scons_arg
|
||||
if details.get('scons_arg') is not None:
|
||||
for line in details.get('scons_arg'):
|
||||
scons_arg.append(line)
|
||||
scons_arg_str=' '.join(scons_arg) if scons_arg else ' '
|
||||
print(f"::group::\tCompiling yml project: =={count}==={name}=scons_arg={scons_arg_str}==")
|
||||
res = build_bsp(bsp, scons_arg_str,name=name)
|
||||
# #开始编译bsp
|
||||
res = build_bsp(bsp, scons_arg_str,name=name,pre_build_commands=pre_build_commands,post_build_command=post_build_command,build_check_result=build_check_result,bsp_build_env =bsp_build_env)
|
||||
if not res:
|
||||
print(f"::error::build {bsp} {name} failed.")
|
||||
add_summary(f'\t- ❌ build {bsp} {name} failed.')
|
||||
@ -235,11 +342,15 @@ if __name__ == "__main__":
|
||||
add_summary(f'\t- ✅ build {bsp} {name} success.')
|
||||
print("::endgroup::")
|
||||
|
||||
|
||||
shutil.copyfile(config_bacakup, config_file)
|
||||
os.remove(config_bacakup)
|
||||
|
||||
|
||||
|
||||
attach_dir = os.path.join(rtt_root, 'bsp', bsp, '.ci/attachconfig')
|
||||
attach_list = []
|
||||
#这里是旧的文件方式
|
||||
for root, dirs, files in os.walk(attach_dir):
|
||||
for file in files:
|
||||
if file.endswith('attach'):
|
||||
|
@ -64,7 +64,8 @@ def GenerateCFiles(env, project, project_name):
|
||||
|
||||
CFLAGS = env['CFLAGS'].replace('\\', "/").replace('\"', "\\\"")
|
||||
if 'CXXFLAGS' in dir(rtconfig):
|
||||
CXXFLAGS = env['CXXFLAGS'].replace('\\', "/").replace('\"', "\\\"")
|
||||
cflag_str=''.join(env['CXXFLAGS'])
|
||||
CXXFLAGS = cflag_str.replace('\\', "/").replace('\"', "\\\"")
|
||||
else:
|
||||
CXXFLAGS = CFLAGS
|
||||
AFLAGS = env['ASFLAGS'].replace('\\', "/").replace('\"', "\\\"")
|
||||
|
Loading…
x
Reference in New Issue
Block a user