Closed fabiencomte closed 4 years ago
Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/MBOTRIAGE-2689
Hi
FPU HW unit is disabled on boot
I don't understand this ?
Hello, If you look in void SystemInit(void) There is / FPU settings ------------------------------------------------------------/
SCB->CPACR |= ((3UL << (10 * 2)) | (3UL << (11 * 2))); /* set CP10 and CP11 Full Access */
That's enable HW FPU if I'm not wrong.
SystemInit
should already be being called well before mbed_init
. It's basically the first thing that happens. See the boot sequence diagram here.
If it hadn't been called, I'm pretty sure you'd be seeing worse problems with non-initialised peripherals.
@fabiencomte Please use the issue template to describe the technical details for the issue. It helps us to understand the problem.
Look at the boot sequence in the documentation referenced above and compare it to what is happening on your hardware. If you find something is not executed, please provide details how to reproduce.
Hello, Where is the Template please ? The problem is quite simple, please search SystemInit function in mbed os sources, it's not called before main. Confirmed by a breakpoint with a jlink probe with ozone debugger.
As indicated by @kjbracey-arm SystemInit is called here: https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H743xI/device/TOOLCHAIN_GCC_ARM/startup_stm32h743xx.S#L93
Hello, Ok but if you set a breakpoint into it (using jlink probe with ozone debugger), you don't go in and you get a hardfault. Why ? Is the debugger use another entry point than Reset_Handler ?
Debuggers have a bunch of settings - there will usually be config choices about whether to stop on Reset_Handler and/or main.
If you can get the thing to stop at Reset_Handler, you should be able to step through and see what's happening.
@fabiencomte when you raise an issue the issue template is inserted automatically. All the fields in this template are required to be filled in. Please add this asap otherwise we may have to close this issue due to insufficient information to reproduce it correctly. Thanks.
Hello @adbridge where is the template please ? Do I have to click something ?
Hello, I found the Template and filled it. Sorry.
If you can get the thing to stop at Reset_Handler, you should be able to step through and see what's happening.
👍 Look at your debugger settings and see where it actually stops. This looks related to a debugger rather than any code issue.
I found the Template and filled it. Sorry.
Thanks for the update.
Hi @fabiencomte Any update? Did you succeed to enter in SystemInit during system init...?
Hi I think we can close the issue ? Thx
I'm seeing what looks a lot like this when attaching a debugger with STM32CubeIDE.
My program is crashing out with a NOCP in the clock code. I'm also using a STM32H743ZI2.
HardFault_Handler() at 0x80002b4
<signal handler called>() at 0xfffffff9
HAL_RCC_GetSysClockFreq() at stm32h7xx_hal_rcc.c:1,391 0x8001874
HAL_RCC_ClockConfig() at stm32h7xx_hal_rcc.c:1,179 0x8001652
SetSysClock_PLL_HSE() at system_clock.c:137 0x80026d4
SetSysClock() at system_clock.c:62 0x80025e8
mbed_sdk_init() at mbed_overrides.c:283 0x80059ca
mbed_init() at stm32h7xx_ll_rcc.h:2,353 0x8005362
_platform_post_stackheap_init() at main.cpp:9 0x8003dce
main() at 0x8000576
I notice there's an Entry(Reset_Handler)
declaration in the TOOLCHAIN_GCC_ARM for this MCU. But no such declaration in TOOLCHAIN_ARM. Is it possible that binaries built with ARMC6 circumvent Reset_Handler
?
Alright, I definitely don't see this with the debugger in Mbed Studio and only see it with the STM32CubeIDE.
I believe the CubeIDE plunks you down at the entry point instead of Reset_Handler
. If I pass --entry=Reset_Handler
to the linker, I get a PRECISERR
bus fault on startup instead of a NOCP
usage fault.
Description of defect
STM32 Hal use floats to compute some HAL values (clocks, ...) but FPU HW unit is disabled on boot and it makes an hardfault.
Target(s) affected by this defect ?
STM32H743ZI2 Nucleo board
Toolchain(s) (name and version) displaying this defect ?
mbed studio 0.9.0 / Ozone debugger 3.20a / jlink probe driver 6.80
What version of Mbed-os are you using (tag or sha) ?
mbed-os-6.0.0 beta 1
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
mbed studio 0.9.0
How is this defect reproduced ?
set -O0 compiler optimizations create an "empty" main run program with Ozone debugger / jlink probe on a STM32H743ZI2 Nucleo board => hardfault
Hello, STM32 Hal use floats to compute some HAL values (clocks, ...) but FPU HW unit is disabled on boot and it makes an hardfault. I temporary fixed it by adding SystemInit(); at the beginning of mbed_init() function
`void mbed_init(void) {
ifdef MBED_DEBUG`
=>
`void mbed_init(void) { SystemInit();
ifdef MBED_DEBUG`