修复真实硬件Os优化启动不了的bug
This commit is contained in:
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
@@ -24,7 +24,8 @@
|
||||
"interface": "swd",
|
||||
"executable": "${workspaceFolder}/build/output/kernel.img.out",
|
||||
"symbolFiles": [
|
||||
"${workspaceFolder}/build/mkrtos/mkrtos_knl/mkrtos.elf"
|
||||
"${workspaceFolder}/build/mkrtos/mkrtos_knl/mkrtos.elf",
|
||||
"${workspaceFolder}/build/mkrtos/mkrtos_user/server/init/init.elf",
|
||||
],
|
||||
"servertype": "jlink",
|
||||
"cwd": "${fileDirname}",
|
||||
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -149,4 +149,5 @@
|
||||
"__config": "c"
|
||||
},
|
||||
"cortex-debug.showRTOS": false,
|
||||
"cortex-debug.variableUseNaturalFormat": false,
|
||||
}
|
||||
@@ -27,7 +27,7 @@ PendSV_Handler:
|
||||
ldr r4, [r4]
|
||||
//! psp为零时,立刻调度一次
|
||||
CBZ r4, thread_sche
|
||||
|
||||
pop {r4}
|
||||
SUB R3, R3, #0x20 //R3 -= 32
|
||||
STM R3, {R4-R11}
|
||||
|
||||
@@ -38,8 +38,10 @@ PendSV_Handler:
|
||||
MOVEQ r1,r3
|
||||
MSRNE PSP, r3
|
||||
MOVNE r0,r3
|
||||
b thread_sche_next
|
||||
thread_sche:
|
||||
pop {r4}
|
||||
thread_sche_next:
|
||||
// r0:psp r1:msp r2:(0为msp 1 psp)
|
||||
LDR.w r3,=schde_to
|
||||
BLX r3
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* @file misc.c
|
||||
* @author zhangzheng (1358745329@qq.com)
|
||||
* @brief
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2023-09-29
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "mm_wrap.h"
|
||||
@@ -158,6 +158,7 @@ again_alloc:
|
||||
if (mpu_calc(ms, pre_alloc_addr, ram_size,
|
||||
&need_align, &alloc_addr) == FALSE)
|
||||
{
|
||||
cpulock_set(status);
|
||||
printk("The MPU area is exhausted.");
|
||||
return NULL;
|
||||
}
|
||||
@@ -165,6 +166,7 @@ again_alloc:
|
||||
void *ram = mm_limit_alloc_align(r_limit, ram_size, need_align);
|
||||
if (!ram)
|
||||
{
|
||||
cpulock_set(status);
|
||||
printk("The system is low on memory.\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -172,10 +174,12 @@ again_alloc:
|
||||
//!< 申请的地址与预分配的地址不同
|
||||
if (ram != (void *)alloc_addr)
|
||||
{
|
||||
cpulock_set(status);
|
||||
printk("Again.\n");
|
||||
mm_limit_free_align(r_limit, ram, need_align);
|
||||
heap = heap->next;
|
||||
goto again_alloc;
|
||||
}
|
||||
cpulock_set(status);
|
||||
return ram;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ static void knl_init_2(void)
|
||||
}
|
||||
thread_ready(init_thread, FALSE);
|
||||
}
|
||||
INIT_STAGE1(knl_init_2);
|
||||
INIT_STAGE2(knl_init_2);
|
||||
|
||||
static void print_mkrtos_info(void)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ set(CMAKE_SIZE "${CROSS_COMPILE}size" CACHE PATH "" FORCE)
|
||||
|
||||
|
||||
# -mfloat-abi=soft -u _printf_float
|
||||
set(CMAKE_C_FLAGS "-mcpu=cortex-m3 -mthumb -O0 -g -lc -lrdimon -mfloat-abi=soft \
|
||||
set(CMAKE_C_FLAGS "-mcpu=cortex-m3 -mthumb -Os -g -lc -lrdimon -mfloat-abi=soft \
|
||||
-std=gnu11 -ffunction-sections -fdata-sections -fno-builtin \
|
||||
-nostartfiles -nodefaultlibs -nostdlib -nostdinc -Xlinker \
|
||||
--gc-sections -fno-stack-protector \
|
||||
|
||||
Reference in New Issue
Block a user