のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

STM32CubeIdeでStatic Libraryを作る方法

  1. STM32 Projectを選択する

    f:id:none53:20190704155754p:plain
    STM32 Project

  2. Boardを選ぶ

    f:id:none53:20190704155927p:plain
    Boardを選ぶ

  3. Static Libraryを選ぶ

    f:id:none53:20190704160016p:plain
    static library

  4. DefaultのStatic Libraryのプロジェクトができる

    f:id:none53:20190704160202p:plain
    DefaultのStatic Libraryのプロジェクトができる

デフォルトのファイル

/**
  ******************************************************************************
  * @file    lib.c
  * @author  Auto-generated by STM32CubeIDE
  * @version V1.0
  * @brief   Default under dev library file.
  ******************************************************************************
*/

/* Includes ------------------------------------------------------------------*/


/** Functions ----------------------------------------------------------------*/
void myFunction(void)
{
    int i = 0;
    i++;
    i++;
    i++;
    i++;
    i++;
    i++;
    i++;
    i++;
    i++;
    i++;
    i++;
    for(;;);
}

プロジェクトのビルド

16:03:42 **** Build of configuration Debug for project testLib ****
make -j4 all 
arm-none-eabi-gcc "../Src/syscalls.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DSTM32 -DSTM32F429ZITx -DSTM32F4 -DDEBUG -DNUCLEO_F429ZI -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Src/syscalls.d" -MT"Src/syscalls.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/syscalls.o"
arm-none-eabi-gcc "../Src/sysmem.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DSTM32 -DSTM32F429ZITx -DSTM32F4 -DDEBUG -DNUCLEO_F429ZI -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Src/sysmem.d" -MT"Src/sysmem.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/sysmem.o"
arm-none-eabi-gcc "../Src/testLib.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DSTM32 -DSTM32F429ZITx -DSTM32F4 -DDEBUG -DNUCLEO_F429ZI -c -I../Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Src/testLib.d" -MT"Src/testLib.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/testLib.o"
arm-none-eabi-ar -r  "libtestLib.a" @"objects.list"  
arm-none-eabi-ar: creating libtestLib.a
Finished building target: libtestLib.a
 

16:03:42 Build Finished. 0 errors, 0 warnings. (took 904ms)