Enlarge minimal stack size
parent
eeab052f71
commit
93c9da9eb4
|
@ -19,7 +19,6 @@ add_compile_flags(BOTH
|
||||||
-ffunction-sections
|
-ffunction-sections
|
||||||
-fdata-sections
|
-fdata-sections
|
||||||
-fstrict-volatile-bitfields
|
-fstrict-volatile-bitfields
|
||||||
-fno-zero-initialized-in-bss
|
|
||||||
-O2
|
-O2
|
||||||
-ggdb
|
-ggdb
|
||||||
)
|
)
|
||||||
|
|
|
@ -53,12 +53,14 @@ SECTIONS
|
||||||
KEEP( *(.text.start) )
|
KEEP( *(.text.start) )
|
||||||
KEEP( *(.text.systick) )
|
KEEP( *(.text.systick) )
|
||||||
} > ram : DATA
|
} > ram : DATA
|
||||||
|
|
||||||
.init :
|
.init :
|
||||||
{
|
{
|
||||||
KEEP (*(SORT_NONE(.init)))
|
KEEP (*(SORT_NONE(.init)))
|
||||||
} > ram : DATA
|
} > ram : DATA
|
||||||
|
|
||||||
|
. = ALIGN(8);
|
||||||
|
. = .;
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
|
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
|
||||||
|
@ -163,6 +165,7 @@ SECTIONS
|
||||||
} > ram : DATA
|
} > ram : DATA
|
||||||
_edata = .; PROVIDE (edata = .);
|
_edata = .; PROVIDE (edata = .);
|
||||||
|
|
||||||
|
. = ALIGN(8);
|
||||||
. = .;
|
. = .;
|
||||||
__bss_start = .;
|
__bss_start = .;
|
||||||
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } > ram : DYN_DATA
|
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } > ram : DYN_DATA
|
||||||
|
|
|
@ -123,6 +123,15 @@ _start:
|
||||||
jr t1
|
jr t1
|
||||||
2:
|
2:
|
||||||
la sp, _idle_stack0_top
|
la sp, _idle_stack0_top
|
||||||
|
|
||||||
|
# clear the bss segment
|
||||||
|
la t0, __bss_start
|
||||||
|
la t1, __bss_end
|
||||||
|
1:
|
||||||
|
sd zero, 0(t0)
|
||||||
|
addi t0, t0, 8
|
||||||
|
bltu t0, t1, 1b
|
||||||
|
|
||||||
la t0, _init_bsp
|
la t0, _init_bsp
|
||||||
jr t0
|
jr t0
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
#define PLL1_OUTPUT_FREQ 160000000UL
|
#define PLL1_OUTPUT_FREQ 160000000UL
|
||||||
#define PLL2_OUTPUT_FREQ 45158400UL
|
#define PLL2_OUTPUT_FREQ 45158400UL
|
||||||
|
|
||||||
extern uint8_t __bss_start[];
|
|
||||||
extern uint8_t __bss_end[];
|
|
||||||
extern uint8_t _tls_data[];
|
extern uint8_t _tls_data[];
|
||||||
|
|
||||||
extern int main(int argc, char *argv[]);
|
extern int main(int argc, char *argv[]);
|
||||||
|
@ -40,15 +38,8 @@ static void setup_clocks()
|
||||||
sysctl_pll_set_freq(SYSCTL_PLL2, PLL2_OUTPUT_FREQ);
|
sysctl_pll_set_freq(SYSCTL_PLL2, PLL2_OUTPUT_FREQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_bss(void)
|
|
||||||
{
|
|
||||||
memset(__bss_start, 0, __bss_end - __bss_start);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _init_bsp()
|
void _init_bsp()
|
||||||
{
|
{
|
||||||
/* Initialize bss data to 0 */
|
|
||||||
init_bss();
|
|
||||||
/* Init FPIOA */
|
/* Init FPIOA */
|
||||||
fpioa_init();
|
fpioa_init();
|
||||||
bsp_pin_setup();
|
bsp_pin_setup();
|
||||||
|
|
|
@ -20,49 +20,49 @@
|
||||||
void __attribute__((weak)) handle_misaligned_fetch(uintptr_t *regs, uintptr_t cause)
|
void __attribute__((weak)) handle_misaligned_fetch(uintptr_t *regs, uintptr_t cause)
|
||||||
{
|
{
|
||||||
dump_core("misaligned fetch", regs, cause);
|
dump_core("misaligned fetch", regs, cause);
|
||||||
exit(1337);
|
sys_exit(1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak)) handle_fault_fetch(uintptr_t *regs, uintptr_t cause)
|
void __attribute__((weak)) handle_fault_fetch(uintptr_t *regs, uintptr_t cause)
|
||||||
{
|
{
|
||||||
dump_core("fault fetch", regs, cause);
|
dump_core("fault fetch", regs, cause);
|
||||||
exit(1337);
|
sys_exit(1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak)) handle_illegal_instruction(uintptr_t *regs, uintptr_t cause)
|
void __attribute__((weak)) handle_illegal_instruction(uintptr_t *regs, uintptr_t cause)
|
||||||
{
|
{
|
||||||
dump_core("illegal instruction", regs, cause);
|
dump_core("illegal instruction", regs, cause);
|
||||||
exit(1337);
|
sys_exit(1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak)) handle_breakpoint(uintptr_t *regs, uintptr_t cause)
|
void __attribute__((weak)) handle_breakpoint(uintptr_t *regs, uintptr_t cause)
|
||||||
{
|
{
|
||||||
dump_core("breakpoint", regs, cause);
|
dump_core("breakpoint", regs, cause);
|
||||||
exit(1337);
|
sys_exit(1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak)) handle_misaligned_load(uintptr_t *regs, uintptr_t cause)
|
void __attribute__((weak)) handle_misaligned_load(uintptr_t *regs, uintptr_t cause)
|
||||||
{
|
{
|
||||||
dump_core("misaligned load", regs, cause);
|
dump_core("misaligned load", regs, cause);
|
||||||
exit(1337);
|
sys_exit(1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak)) handle_fault_load(uintptr_t *regs, uintptr_t cause)
|
void __attribute__((weak)) handle_fault_load(uintptr_t *regs, uintptr_t cause)
|
||||||
{
|
{
|
||||||
dump_core("fault load", regs, cause);
|
dump_core("fault load", regs, cause);
|
||||||
exit(1337);
|
sys_exit(1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak)) handle_misaligned_store(uintptr_t *regs, uintptr_t cause)
|
void __attribute__((weak)) handle_misaligned_store(uintptr_t *regs, uintptr_t cause)
|
||||||
{
|
{
|
||||||
dump_core("misaligned store", regs, cause);
|
dump_core("misaligned store", regs, cause);
|
||||||
exit(1337);
|
sys_exit(1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak)) handle_fault_store(uintptr_t *regs, uintptr_t cause)
|
void __attribute__((weak)) handle_fault_store(uintptr_t *regs, uintptr_t cause)
|
||||||
{
|
{
|
||||||
dump_core("fault store", regs, cause);
|
dump_core("fault store", regs, cause);
|
||||||
exit(1337);
|
sys_exit(1337);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_except(uintptr_t *regs, uintptr_t cause)
|
void handle_except(uintptr_t *regs, uintptr_t cause)
|
||||||
|
|
|
@ -46,6 +46,7 @@ void handle_irq_m_soft(uintptr_t *regs, uintptr_t cause);
|
||||||
void handle_irq_m_timer(uintptr_t *regs, uintptr_t cause);
|
void handle_irq_m_timer(uintptr_t *regs, uintptr_t cause);
|
||||||
void handle_irq_m_ext(uintptr_t *regs, uintptr_t cause);
|
void handle_irq_m_ext(uintptr_t *regs, uintptr_t cause);
|
||||||
void handle_syscall(uintptr_t *regs, uintptr_t cause);
|
void handle_syscall(uintptr_t *regs, uintptr_t cause);
|
||||||
|
void __attribute__((noreturn)) sys_exit(int code);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -92,7 +92,7 @@ enum
|
||||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
|
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
|
||||||
|
|
||||||
/* memory */
|
/* memory */
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 1024 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 20480 )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1024 * 1024 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1024 * 1024 ) )
|
||||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||||
|
|
|
@ -48,10 +48,6 @@ static void main_thunk(void *p)
|
||||||
/* Init libc array for C++ */
|
/* Init libc array for C++ */
|
||||||
__libc_init_array();
|
__libc_init_array();
|
||||||
|
|
||||||
clear_csr(mie, MIP_MTIP);
|
|
||||||
clint_ipi_enable();
|
|
||||||
set_csr(mstatus, MSTATUS_MIE);
|
|
||||||
|
|
||||||
install_hal();
|
install_hal();
|
||||||
install_drivers();
|
install_drivers();
|
||||||
configure_fpioa();
|
configure_fpioa();
|
||||||
|
@ -71,6 +67,10 @@ static void os_entry_core1()
|
||||||
|
|
||||||
int os_entry(int (*user_main)(int, char **))
|
int os_entry(int (*user_main)(int, char **))
|
||||||
{
|
{
|
||||||
|
clear_csr(mie, MIP_MTIP);
|
||||||
|
clint_ipi_enable();
|
||||||
|
set_csr(mstatus, MSTATUS_MIE);
|
||||||
|
|
||||||
TaskHandle_t mainTask;
|
TaskHandle_t mainTask;
|
||||||
main_thunk_param_t param = {};
|
main_thunk_param_t param = {};
|
||||||
param.user_main = user_main;
|
param.user_main = user_main;
|
||||||
|
|
|
@ -160,7 +160,7 @@ int vPortSetInterruptMask(void)
|
||||||
int ret;
|
int ret;
|
||||||
__asm volatile("csrr %0,mie"
|
__asm volatile("csrr %0,mie"
|
||||||
: "=r"(ret));
|
: "=r"(ret));
|
||||||
__asm volatile("csrc mie,%0" ::"i"(7));
|
__asm volatile("csrc mie,%0" ::"r"(0x888));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in New Issue