diff --git a/arm_mps3_an547/liteos_m/board/main.c b/arm_mps3_an547/liteos_m/board/main.c index 3cf2390cb2349ca4f211d422cc82d6da64f3b82c..98bc403e0a59c2aaad632b4b6693d007e76e6986 100755 --- a/arm_mps3_an547/liteos_m/board/main.c +++ b/arm_mps3_an547/liteos_m/board/main.c @@ -34,15 +34,36 @@ unsigned int LosAppInit(VOID); unsigned int LosShellInit(void); +// Enable EPU +static void EPUInit(void) +{ +#if ((__FPU_PRESENT == 1U) && (__FPU_USED == 1U)) + __asm volatile + ( + " .equ CPACR, 0xE000ED88 \n" + " \n" + " ldr r0, =CPACR \n" + " ldr r1, [r0] \n" + " orr r1, r1, #(0xf << 20) \n" + " str r1, [r0] \n" + " dsb \n" + " isb \n" + " \n" + " .align 4 \n" + ); +#endif +} + LITE_OS_SEC_TEXT_INIT int main(void) { unsigned int ret; + EPUInit(); UartInit(); ret = LOS_KernelInit(); if (ret != LOS_OK) { - printf("Liteos kernel init failed! ERROR: %d\n", ret); + printf("Liteos kernel init failed! ERROR: %u\n", ret); goto EXIT; } @@ -51,13 +72,13 @@ LITE_OS_SEC_TEXT_INIT int main(void) #if (LOSCFG_USE_SHELL == 1) ret = LosShellInit(); if (ret != LOS_OK) { - printf("LosAppInit failed! ERROR: %d\n", ret); + printf("LosAppInit failed! ERROR: %u\n", ret); } #endif ret = LosAppInit(); if (ret != LOS_OK) { - printf("LosAppInit failed! ERROR: %d\n", ret); + printf("LosAppInit failed! ERROR: %u\n", ret); } LOS_Start(); diff --git a/arm_mps3_an547/liteos_m/board/startup.s b/arm_mps3_an547/liteos_m/board/startup.s index d71866fbcc416aa03a2da478cee8b976931e82ca..ba5faee986a9da23b6051d3d4933697a32123ffb 100755 --- a/arm_mps3_an547/liteos_m/board/startup.s +++ b/arm_mps3_an547/liteos_m/board/startup.s @@ -33,8 +33,6 @@ .fpu vfpv3-d16-fp16 .thumb -.equ CPACR, 0xE000ED88 - .extern HalExcNMI; .extern HalExcHardFault; .extern HalExcMemFault; @@ -59,14 +57,6 @@ bss_loop: subs r3, r1, r0 bne bss_loop - // Enable EPU - ldr r0, =CPACR - ldr r1, [r0] - orr r1, r1, #(0xf << 20) - str r1, [r0] - dsb - isb - ldr sp, =__irq_stack_top b main .size Reset_Handler, .-Reset_Handler diff --git a/arm_mps3_an547/liteos_m/config.gni b/arm_mps3_an547/liteos_m/config.gni index cdc21923214235b1a85aa749453c8c38ed189b8c..f1ecc63fe629469032a803012cfe584234408cc0 100755 --- a/arm_mps3_an547/liteos_m/config.gni +++ b/arm_mps3_an547/liteos_m/config.gni @@ -52,6 +52,7 @@ board_cflags = [ "-ffunction-sections", "-fno-builtin", "-fno-strict-aliasing", + "-mno-unaligned-access", "-fsigned-char", "-std=c99", "-Os",