Project Configuration and Management#

Create a GNU Arm Static Library Project#

Simplicity Studio 6 does not provide a built-in option for generating static libraries. However, for projects using the arm-none-eabi-gcc GNU Arm Embedded Toolchain, you can modify the generated CMakeLists.txt to produce a .a static library instead of an executable.

  1. Open the CMakeLists.txt file.

  2. Change the add_executable() section to an add_library() section with the STATIC keyword:

    Before change:

    add_executable(blink_pwm_baremetal
        # Add additional sources here
    )

    After change:

    add_library(blink_pwm_baremetal STATIC
        # Add additional sources here
    )
  3. Comment out or remove the sections that copy the executable into other formats and run post-build commands.

    Commented-out sections:

    # Create .bin, .hex and .s37 artifacts after building the project
    #add_custom_command(TARGET blink_pwm_baremetal
        # POST_BUILD
        # COMMAND ${CMAKE_OBJCOPY} ${OBJCOPY_SREC_CMD}"$<TARGET_FILE:blink_pwm_baremetal>" "$<TARGET_FILE_DIR:blink_pwm_baremetal>/$<TARGET_FILE_BASE_NAME:blink_pwm_baremetal>.s37"
        # COMMAND ${CMAKE_OBJCOPY} ${OBJCOPY_IHEX_CMD} "$<TARGET_FILE:blink_pwm_baremetal>" "$<TARGET_FILE_DIR:blink_pwm_baremetal>/$<TARGET_FILE_BASE_NAME:blink_pwm_baremetal>.hex"
        # COMMAND ${CMAKE_OBJCOPY} ${OBJCOPY_BIN_CMD}  "$<TARGET_FILE:blink_pwm_baremetal>" "$<TARGET_FILE_DIR:blink_pwm_baremetal>/$<TARGET_FILE_BASE_NAME:blink_pwm_baremetal>.bin" 
    #)
    # Run post-build pipeline to perform additional post-processing
    #if(post_build_command)
    #add_custom_command(TARGET blink_pwm_baremetal
        # POST_BUILD
        # WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/..
        # COMMAND ${post_build_command}
    #)
    #endif()
  4. Save the file.

You can now build the project to create the static library object of the form libPROJECTNAME.a.