圏9研究所 工作室

圏9研究所の開発情報資料など

AT32F403A BlackPill:その4 FPU

Cortex-M4FのFPUを動かしてみる

1.手順
1)コーディング: STM32CubeIDE(MX)
 ・STM32CubeIDE(MX)を使ってSTM32F103RGT6でプロジェクトを作成しコードを書く
 ・関数として math library と CMSIS-DSP を使う
 ・FPUを使えるようにコードを変える

2)コンパイル
 ・Coretex-M3 FPUなしの設定を Cortex-M4 FPUありに変えてコンパイルする

3)書込み: MINI ST-LINK V2 + openOCD + IDCODEコンバーター

 

2.コーディング
1)FPUを使えるようにコードを変える:stm32f103xg.h
 プロジェクト名/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xg.h
・__CM4_REV 設定
・__FPU_PRESENT 1U
・#include “core_cm4.h”

/*

 * @brief Configuration of the Cortex-M3 Processor and Core Peripherals 
 */
//#define __CM3_REV                  0x0200U  /*!< Core Revision r2p0                           */
// #define __MPU_PRESENT             1U       /*!< STM32 XL-density devices provide an MPU      */
//#define __NVIC_PRIO_BITS           4U       /*!< STM32 uses 4 Bits for the Priority Levels    */
//#define __Vendor_SysTickConfig     0U       /*!< Set to 1 if different SysTick Config is used */

#define __CM4_REV                 0x0001U  /*!< Core revision r0p1                            */
#define __MPU_PRESENT             1U       /*!< STM32F4XX provides an MPU                     */
#define __NVIC_PRIO_BITS          4U       /*!< STM32F4XX uses 4 Bits for the Priority Levels */
#define __Vendor_SysTickConfig    0U       /*!< Set to 1 if different SysTick Config is used  */
#define __FPU_PRESENT             1U       /*!< FPU present                                   */


//#include "core_cm3.h"
#include "core_cm4.h"
#include "system_stm32f1xx.h"
#include <stdint.h>