From 2a322620538dcc26b6ee053c19a8a9dfed1116ef Mon Sep 17 00:00:00 2001 From: KLASSENTS Date: Tue, 25 Mar 2025 17:01:14 +0700 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81?= =?UTF-8?q?=D0=BB=D0=B0=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87?= =?UTF-8?q?=D0=B8=D0=BA=20=D0=BF=D1=80=D0=B5=D1=80=D1=8B=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BE=D1=82=20freeRTOS=20=D0=B2=20=D1=80=D0=B0?= =?UTF-8?q?=D0=BC=D0=BA=D1=83=20=D0=B8=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0?= =?UTF-8?q?=D0=BB=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BD=D0=B5=D0=B3=D0=BE=20=D1=87=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B7=20j=20=D0=B2=20trap=5Fentry,=20=D1=82=D0=B5=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D1=8C=20=D0=BA=D0=B0=D0=BA=20=D0=B1=D1=83=D0=B4?= =?UTF-8?q?=D1=82=D0=BE=20=D0=B7=D0=B0=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=D0=BB=D0=BE.=20=D0=91=D0=BB=D0=B8=D0=BD=D0=BA=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82,=20=D0=BD=D0=BE=20analogRe?= =?UTF-8?q?ad=20=D0=BE=D1=87=D0=B5=D0=BD=D1=8C=20=D1=82=D0=BE=D1=80=D0=BC?= =?UTF-8?q?=D0=BE=D0=B7=D0=B8=D1=82=20=D0=BF=D0=BE=D1=87=D0=B5=D0=BC=D1=83?= =?UTF-8?q?-=D1=82=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cores/arduino/mik32/shared/runtime/crt0.S | 6 ++---- libraries/FreeRTOS/src/FreeRTOSConfig.h | 4 ++-- libraries/FreeRTOS/src/portASM.S | 5 +++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cores/arduino/mik32/shared/runtime/crt0.S b/cores/arduino/mik32/shared/runtime/crt0.S index 3730d85..ee9d26f 100644 --- a/cores/arduino/mik32/shared/runtime/crt0.S +++ b/cores/arduino/mik32/shared/runtime/crt0.S @@ -112,11 +112,9 @@ SystemInit: .section .trap_text, "ax" // .org should be consistent with // default mtvec value (set in scr1_arch_description.svh) -//.org 0xC0 +//.org 0xC0 //j raw_trap_handler trap_entry: - // j raw_trap_handler - la t0, freertos_risc_v_trap_handler - jalr t0 + j freertos_risc_v_trap_handler raw_trap_handler: // Save registers diff --git a/libraries/FreeRTOS/src/FreeRTOSConfig.h b/libraries/FreeRTOS/src/FreeRTOSConfig.h index 980fb77..e3ba88a 100644 --- a/libraries/FreeRTOS/src/FreeRTOSConfig.h +++ b/libraries/FreeRTOS/src/FreeRTOSConfig.h @@ -47,8 +47,8 @@ extern "C" { /* Set the stack depth type to be uint16_t, otherwise it defaults to StackType_t */ #define configSTACK_DEPTH_TYPE uint16_t -#define configMINIMAL_STACK_SIZE 192 -#define configISR_STACK_SIZE_WORDS 128 // todo сколько надо? +#define configMINIMAL_STACK_SIZE 256 +// #define configISR_STACK_SIZE_WORDS 128 // todo сколько надо? #define configCHECK_FOR_STACK_OVERFLOW 1 #define configUSE_TRACE_FACILITY 0 diff --git a/libraries/FreeRTOS/src/portASM.S b/libraries/FreeRTOS/src/portASM.S index 1b785dc..8298232 100644 --- a/libraries/FreeRTOS/src/portASM.S +++ b/libraries/FreeRTOS/src/portASM.S @@ -116,7 +116,7 @@ definitions. */ add t2, a3, t1 /* Add overflow to high word of ullNextTime. */ sw a4, 0(a1) /* Store new low word of ullNextTime. */ sw t2, 4(a1) /* Store new high word of ullNextTime. */ - + #endif /* __riscv_xlen == 32 */ #if( __riscv_xlen == 64 ) @@ -326,7 +326,7 @@ exit_without_context_switch: portcontextRESTORE_CONTEXT /*-----------------------------------------------------------*/ -.section .text.freertos_risc_v_trap_handler +.section .ram_text .align 8 freertos_risc_v_trap_handler: portcontextSAVE_CONTEXT_INTERNAL @@ -357,6 +357,7 @@ handle_interrupt: bne a0, t1, application_interrupt_handler portUPDATE_MTIMER_COMPARE_REGISTER + call toggleTestPin call xTaskIncrementTick beqz a0, processed_source /* Don't switch context if incrementing tick didn't unblock a task. */ call vTaskSwitchContext