diff options
| author | Bernard Xiong <[email protected]> | 2020-12-27 01:00:32 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-27 01:00:32 +0800 |
| commit | d22fde635bfdfc01208092100133af8678ee174c (patch) | |
| tree | 7ad39bb196cd08e6dc3266bb59b69871f684b376 | |
| parent | 9a59737b5fd2dd8aaeb5f4810ddab32f5d5fd470 (diff) | |
| parent | 08aa4e5462a3d480114cfd8e61e9f7dc7c0b10c9 (diff) | |
Merge pull request #4193 from greedyhao/bluetrum
[bsp][bluetrum] fix context switch error
| -rw-r--r-- | bsp/bluetrum/ab32vg1-ab-prougen/.config | 7 | ||||
| -rw-r--r-- | bsp/bluetrum/ab32vg1-ab-prougen/link.lds | 37 | ||||
| -rw-r--r-- | bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.h | 4 | ||||
| -rw-r--r-- | bsp/bluetrum/libcpu/cpu/context_gcc.S | 8 | ||||
| -rw-r--r-- | bsp/bluetrum/libcpu/cpu/cpuport.c | 2 |
5 files changed, 34 insertions, 24 deletions
diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/.config b/bsp/bluetrum/ab32vg1-ab-prougen/.config index ae0ddcec8b..d6b19f6f8b 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/.config +++ b/bsp/bluetrum/ab32vg1-ab-prougen/.config @@ -288,6 +288,7 @@ CONFIG_RT_USING_LIBC=y # CONFIG_PKG_USING_PDULIB is not set # CONFIG_PKG_USING_BTSTACK is not set # CONFIG_PKG_USING_LORAWAN_ED_STACK is not set +# CONFIG_PKG_USING_WAYZ_IOTKIT is not set # # security packages @@ -437,6 +438,8 @@ CONFIG_RT_USING_LIBC=y # CONFIG_PKG_USING_QKEY is not set # CONFIG_PKG_USING_RS485 is not set # CONFIG_PKG_USING_NES is not set +# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set +# CONFIG_PKG_USING_VDEVICE is not set # # miscellaneous packages @@ -495,13 +498,13 @@ CONFIG_RT_USING_LIBC=y # Onboard Peripheral Drivers # CONFIG_BSP_USING_USB_TO_USART=y +CONFIG_BSP_USING_AUDIO=y +CONFIG_BSP_USING_AUDIO_PLAY=y # # On-chip Peripheral Drivers # CONFIG_BSP_USING_UART0=y -CONFIG_BSP_USING_AUDIO=y -CONFIG_BSP_USING_AUDIO_PLAY=y # # Board extended module Drivers diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/link.lds b/bsp/bluetrum/ab32vg1-ab-prougen/link.lds index 5545374c9d..10d5b3b590 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/link.lds +++ b/bsp/bluetrum/ab32vg1-ab-prougen/link.lds @@ -1,9 +1,9 @@ /* Define the flash max size */ -__max_flash_size = 768k; +__max_flash_size = 1024k; -__data_ram_size = 5k; +__data_ram_size = 8k; __stack_ram_size = 4k; -__comm_ram_size = 86k; +__comm_ram_size = 83k; __heap_ram_size = 29k; __base = 0x10000000; @@ -34,13 +34,8 @@ SECTIONS } > init .ram1 __ram1_vma : { - *hal_drivers**.o(.text*) - *hal_libraries*ab32vg1_hal**.o(.text*) *components*drivers**.o(.text* .rodata*) - *components*libc**.o(.text*) - *ab32vg1_hal_msp.o(.text*) - *components.o(.text* .rodata*) - *ipc.o(.text* .rodata*) + *device.o(.text*) . = ALIGN(32); } > ram1 AT > flash @@ -65,8 +60,14 @@ SECTIONS } > ram1 AT > flash .comm : { - KEEP(*(.vector)) - EXCLUDE_FILE (*romfs.o *lib_a**.o) *(.text*) + KEEP (*(.vector)) + EXCLUDE_FILE (*hal_drivers**.o *ab32vg1_hal**.o *components*finsh**.o *components*libc**.o *rt-thread*src**.o *kernel*src**.o *romfs.o *lib_a**.o) *(.text*) + *idle.o (.text*) + *ipc.o (.text*) + *irq.o (.text*) + *scheduler.o (.text*) + *timer.o (.text*) + *kservice.o (.text*) EXCLUDE_FILE (*romfs.o *lib_a**.o) *(.rodata*) *(.srodata*) *(.rela*) @@ -75,12 +76,6 @@ SECTIONS . = ALIGN(512); } > comm AT > flash - .flash : { - *romfs.o *(.text* .rodata*) - *lib_a**.o *(.text* .rodata*) - . = ALIGN(512); - } > flash - .bss (NOLOAD): { __bss_start = .; @@ -99,11 +94,17 @@ SECTIONS } > stack __irq_stack_size = __irq_stack - __irq_stack_start; - .heap : { + .heap (NOLOAD) : { __heap_start = .; . = __heap_ram_size; __heap_end = .; } > heap + + .flash : { + *(.text*) + *(.rodata*) + . = ALIGN(512); + } > flash } /* Calc the lma */ diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.h b/bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.h index a123d38a5e..3ce6012a61 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.h +++ b/bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.h @@ -169,12 +169,12 @@ /* Onboard Peripheral Drivers */ #define BSP_USING_USB_TO_USART +#define BSP_USING_AUDIO +#define BSP_USING_AUDIO_PLAY /* On-chip Peripheral Drivers */ #define BSP_USING_UART0 -#define BSP_USING_AUDIO -#define BSP_USING_AUDIO_PLAY /* Board extended module Drivers */ diff --git a/bsp/bluetrum/libcpu/cpu/context_gcc.S b/bsp/bluetrum/libcpu/cpu/context_gcc.S index 9139657eaa..e9a6cc28e3 100644 --- a/bsp/bluetrum/libcpu/cpu/context_gcc.S +++ b/bsp/bluetrum/libcpu/cpu/context_gcc.S @@ -44,7 +44,7 @@ enable_int_ret: /* Macro for saving task context */ .macro save_context - addi sp, sp, -120 + addi sp, sp, -124 /* Save Context */ sw x1, 0(sp) @@ -79,6 +79,8 @@ enable_int_ret: lw a5, EPC(zero) //Saves current program counter (EPC) as task program counter sw a5, 116(sp) + lw a5, EPICCON(zero) + sw a5, 120(sp) sw sp, rt_cur_thread_sp, a4 //store sp in preempted tasks tcb .endm @@ -93,6 +95,8 @@ enable_int_ret: /* Load task program counter EPC*/ lw a5, 116(sp) sw a5, EPC(zero) + lw a5, 120(sp) + sw a5, EPICCON(zero) /* Restore registers, Skip global pointer because that does not change */ @@ -126,7 +130,7 @@ enable_int_ret: lw x30, 108(sp) lw x31, 112(sp) - addi sp, sp, 120 + addi sp, sp, 124 mret .endm diff --git a/bsp/bluetrum/libcpu/cpu/cpuport.c b/bsp/bluetrum/libcpu/cpu/cpuport.c index 576401421a..7689018a51 100644 --- a/bsp/bluetrum/libcpu/cpu/cpuport.c +++ b/bsp/bluetrum/libcpu/cpu/cpuport.c @@ -40,6 +40,8 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, stk = (rt_uint32_t *)stack_addr; stk--; + *stk = (rt_uint32_t)0x10003; /* Start address */ + stk--; *stk = (rt_uint32_t)tentry; /* Start address */ stk -= 22; *stk = (rt_uint32_t)parameter; /* Register a0 parameter*/ |
