Page 1 of 1

FPU leads to unhandled exception

Posted: Wed Apr 13, 2016 2:18 pm
by neums
Hi,
i use the STM32F407 Discovery Board. If i set the compiler setting USE_FPU = softfp, i get an unhandled exception at startup.

Code: Select all

# Stack size to be allocated to the Cortex-M process stack. This stack is
# the stack used by the main() thread.
ifeq ($(USE_PROCESS_STACKSIZE),)
  USE_PROCESS_STACKSIZE = 0x400
endif

# Stack size to the allocated to the Cortex-M main/exceptions stack. This
# stack is used for processing interrupts and exceptions.
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
  USE_EXCEPTIONS_STACKSIZE = 0x400
endif

# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),)
  USE_FPU = softfp
endif


I debugged it until i set a breakpoint at

Code: Select all

08000262:  bl      0x80037d0 <__init_ram_areas>

If the controller stops there by breakpoint and i resume everything works fine. But what is the difference between stopping and do not so?

Thanks you

Re: FPU leads to unhandled exception

Posted: Wed Apr 13, 2016 3:28 pm
by Giovanni
Hi,

What ChibiOS version are you using?

Without debugger attached does the system starts?

Giovanni

Re: FPU leads to unhandled exception

Posted: Thu Apr 14, 2016 7:04 am
by neums
Hi,
i use 16.1.4. But i do not use the kernel just the hal.
The bootloader is just a main function and jumps at the end to the application by

Code: Select all

static void application_jump() {
  typedef  void (*pFunction)(void);
  pFunction jumpToApplication = (pFunction) *(__IO uint32_t*)(APPLICATION_ADDRESS + 4);
  /* Initialize user application's Stack Pointer */
  __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
  jumpToApplication();
}

Do i have to call a __set_CONTROL(0); before jumping to the application?

My application is driven by SysTick handler and a static task table which contains the function pointer of certain tasks. But this does not matter because the system crashes before it reaches the application main function.

Without the debugger the system does not start too.

Re: FPU leads to unhandled exception

Posted: Thu Apr 14, 2016 7:58 am
by Giovanni
You should inspect the NVIC state and see what kind of exception you are getting there. This would give us an hint of the problem.

Giovanni

Re: FPU leads to unhandled exception

Posted: Thu Apr 14, 2016 12:18 pm
by neums
When i debug my bootloader with fpu option set to "hard" i get an HardFault (information read in xPSR).

Re: FPU leads to unhandled exception

Posted: Thu Apr 14, 2016 12:21 pm
by Giovanni
So, where exactly? moving a breakpoint should reveal that.

Giovanni

Re: FPU leads to unhandled exception

Posted: Thu Apr 14, 2016 3:50 pm
by neums
Broken board... I took a new discovery board and everything works fine. But the broken one works also, just without FPU. Please, don't ask me why. With FPU the it hangs sometimes in early_init and waits für HSI and sometimes i got a hard fault. I can not reproduce it exactly now. Thanks for your help.

Re: FPU leads to unhandled exception

Posted: Thu Apr 14, 2016 4:41 pm
by Giovanni
Weird, have devices the same stepping?

Giovanni