FPU leads to unhandled exception

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Has thanked: 10 times
Been thanked: 5 times

FPU leads to unhandled exception

Post 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
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: FPU leads to unhandled exception

Post by Giovanni »

Hi,

What ChibiOS version are you using?

Without debugger attached does the system starts?

Giovanni
neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Has thanked: 10 times
Been thanked: 5 times

Re: FPU leads to unhandled exception

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: FPU leads to unhandled exception

Post 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
neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Has thanked: 10 times
Been thanked: 5 times

Re: FPU leads to unhandled exception

Post by neums »

When i debug my bootloader with fpu option set to "hard" i get an HardFault (information read in xPSR).
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: FPU leads to unhandled exception

Post by Giovanni »

So, where exactly? moving a breakpoint should reveal that.

Giovanni
neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Has thanked: 10 times
Been thanked: 5 times

Re: FPU leads to unhandled exception

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: FPU leads to unhandled exception

Post by Giovanni »

Weird, have devices the same stepping?

Giovanni
Post Reply