Tutorial Microcontroller MCS-51 ATMEL ISP
 

 

Super MCS51 Trainer

Standart MCS51 Trainer

Standart AVR Trainer

Programmer USBASP

Standart ARM Trainer

 

STM32F4 Discovery HARDFPU - CooCox CoIDE Floating Point

This is a little howto for setting up of STM32F4 development board with float variables into the processor flag set at HARDFPU in IDE developed by CooCox

1. Firstly set up HSE_VALUE

> in system_stm32f4xx.c change the external oscilator            frequency
  HSE_VALUE=8000000
> discovery board has not default pre-stock frequency (which is 25MHz) it has 8MHz

2. Change stack size

> in startup/startup_stm32f4xx.c) change
  (void *)&pulStack[STACK_SIZE-1],
> to
  (void (*)(void))((unsigned long)pulStack + sizeof(pulStack)),
> bigger stack size = in startup/startup_stm32f4xx.c
  #define STACK_SIZE 0x00002000 /*!< Stack size (in Words) */

3. Include file stdio.h

> include wherever it's needed - main.c, syscall.c            etc.
  #include <stdio.h>
> in main before printf cast
  /* Set unbuffered mode for stdout (newlib) */
  setvbuf( stdout, 0, _IONBF, 0 ); 

4. Un comment SystemInit

> in startup_stm32f4xx.c un-comment
  extern void SystemInit(void); /*!< Setup the microcontroller system(CMSIS)

5. Call SystemInit

> in startup_stm32f4xx.c add SystemInit(); call before main(); function call in
  void DefaultResetHandler()
  {
   ..
   SystemInit();
   main();
  }

6. Example how to process floating point number

int main(void)
{
  float f = 10.123;
  sprint(buf, "0.4f",f);
  while(1) {}
}

7. Download templete system_stm32f4xx.c, system_stm32f4xx.c.