ОС работает, пользовательские прерывания тоже работают. Осталось придумать, как в trap_entry идти в нужную функцию, если библиотека не подключена

This commit is contained in:
KLASSENTS 2025-03-26 16:30:07 +07:00
parent 902d7b0932
commit 42e9becdb9
5 changed files with 9 additions and 8 deletions

View File

@ -123,6 +123,7 @@ SECTIONS {
PROVIDE(__STACK_START__ = .); PROVIDE(__STACK_START__ = .);
. += STACK_SIZE; . += STACK_SIZE;
PROVIDE(__C_STACK_TOP__ = .); PROVIDE(__C_STACK_TOP__ = .);
PROVIDE(__freertos_irq_stack_top = .);
PROVIDE(__STACK_END__ = .); PROVIDE(__STACK_END__ = .);
} >ram } >ram

View File

@ -112,8 +112,9 @@ SystemInit:
.section .trap_text, "ax" .section .trap_text, "ax"
// .org should be consistent with // .org should be consistent with
// default mtvec value (set in scr1_arch_description.svh) // default mtvec value (set in scr1_arch_description.svh)
//.org 0xC0 //j raw_trap_handler //.org 0xC0
trap_entry: trap_entry:
//j raw_trap_handler
j freertos_risc_v_trap_handler j freertos_risc_v_trap_handler
raw_trap_handler: raw_trap_handler:

View File

@ -42,12 +42,12 @@ extern "C" {
#define configMAX_PRIORITIES 4 #define configMAX_PRIORITIES 4
#define configMAX_TASK_NAME_LEN 16 #define configMAX_TASK_NAME_LEN 16
#define configTOTAL_HEAP_SIZE ( ( size_t ) 3*1024 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) 5*1024 )
/* Set the stack depth type to be uint16_t, otherwise it defaults to StackType_t */ /* Set the stack depth type to be uint16_t, otherwise it defaults to StackType_t */
#define configSTACK_DEPTH_TYPE uint16_t #define configSTACK_DEPTH_TYPE uint16_t
#define configMINIMAL_STACK_SIZE 256 #define configMINIMAL_STACK_SIZE 192
// #define configISR_STACK_SIZE_WORDS 128 // todo сколько надо? // #define configISR_STACK_SIZE_WORDS 128 // todo сколько надо?
#define configCHECK_FOR_STACK_OVERFLOW 1 #define configCHECK_FOR_STACK_OVERFLOW 1
#define configUSE_TRACE_FACILITY 0 #define configUSE_TRACE_FACILITY 0
@ -122,5 +122,4 @@ to exclude the API function. */
#endif #endif
#endif #endif
#endif /* FREERTOS_CONFIG_H */ #endif /* FREERTOS_CONFIG_H */

View File

@ -92,6 +92,7 @@ definitions. */
.extern pullNextTime .extern pullNextTime
.extern uxTimerIncrementsForOneTick /* size_t type so 32-bit on 32-bit core and 64-bits on 64-bit core. */ .extern uxTimerIncrementsForOneTick /* size_t type so 32-bit on 32-bit core and 64-bits on 64-bit core. */
.extern xTaskReturnAddress .extern xTaskReturnAddress
.extern trap_handler
.weak freertos_risc_v_application_exception_handler .weak freertos_risc_v_application_exception_handler
.weak freertos_risc_v_application_interrupt_handler .weak freertos_risc_v_application_interrupt_handler
@ -366,7 +367,7 @@ handle_interrupt:
#endif /* portasmHAS_MTIME */ #endif /* portasmHAS_MTIME */
application_interrupt_handler: application_interrupt_handler:
call freertos_risc_v_application_interrupt_handler call trap_handler
j processed_source j processed_source
handle_exception: handle_exception:

View File

@ -38,10 +38,9 @@ extern void loop(void);
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void initVariant(void) __attribute__((used, retain)); // todo удалить лишний атрибут? void initVariant(void) // todo удалить
void initVariant(void)
{ {
initTestPin();
setup(); // the normal Arduino setup() function is run here. setup(); // the normal Arduino setup() function is run here.
post_init(); post_init();
vTaskStartScheduler(); // initialise and run the freeRTOS scheduler. Execution should never return here. vTaskStartScheduler(); // initialise and run the freeRTOS scheduler. Execution should never return here.