Things used in this project

Hardware components:
Ek tm4c123gxl tivalp angle new
TI LaunchPad EK-TM4C123GXL LaunchPad
×1
Software apps and online services:
lm4tools
CMake
Make

Code

CMakeLists.txtPlain text
The main file that CMake creates the Make file in the build directory from.
cmake_minimum_required(VERSION 3.8.2)
project(linux_blinky)

#Toolchain file
include(tm4c123g.cmake)

#Tivaware files
set(TIVAWARE_PATH "$ENV{HOME}/Documents/tiva-projects/tivaware")
include_directories(${TIVAWARE_PATH})

#Source files
file(GLOB SOURCES "src/*.c")
add_executable(${CMAKE_PROJECT_NAME}.axf ${SOURCES})

target_link_libraries(${CMAKE_PROJECT_NAME}.axf 
    ${TIVAWARE_PATH}/usblib/gcc/libusb.a

    ${TIVAWARE_PATH}/driverlib/gcc/libdriver.a
)
tm4c123g.cmakePlain text
Sets up compiler and flags used for cross-compilation as well as the Make file target.
#Set cross compilation information
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)

# GCC toolchain prefix
set(TOOLCHAIN_PREFIX "arm-none-eabi")

set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}-as)
set(CMAKE_AR ${TOOLCHAIN_PREFIX}-ar)
set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}-objcopy)
set(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}-objdump)

enable_language(ASM)

set(CPU "-mcpu=cortex-m4")
set(FPU "-mfpu=fpv4-sp-d16 -mfloat-abi=softfp")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -mthumb ${CPU}  ${FPU} -MD")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthumb ${CPU} ${FPU} -std=gnu99 -Os -ffunction-sections -fdata-sections -MD -Wall -pedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthumb ${CPU} ${FPU}  -Os -ffunction-sections -fdata-sections -MD -Wall -pedantic -fno-exceptions -fno-rtti")

set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set(CMAKE_EXE_LINKER_FLAGS "-T${PROJECT_SOURCE_DIR}/tm4c123g.ld -specs=${PROJECT_SOURCE_DIR}/tiva.specs")

# Processor specific definitions
add_definitions(-DPART_TM4C123GH6PM)
add_definitions(-DTARGET_IS_TM4C123_RA1)
add_definitions(-Dgcc)

set(FLASH_EXECUTABLE "lm4flash")
ADD_CUSTOM_TARGET("flash" DEPENDS ${CMAKE_PROJECT_NAME}.axf 
  COMMAND ${CMAKE_OBJCOPY} -O binary ${CMAKE_PROJECT_NAME}.axf ${CMAKE_PROJECT_NAME}.bin 
  COMMAND ${FLASH_EXECUTABLE} ${CMAKE_PROJECT_NAME}.bin
)
My repository demonstrating a blinky example

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Got Your Back
Intermediate
  • 2,112
  • 51

Full instructions

This ergonomic-sensitive chair add-on will help you chair-ish your health!

Got Your Back

#creaTIviteam

TiWo
Intermediate
  • 1,445
  • 35

Full instructions

TiWo, keepin' it cool

TiWo

Team ElectroVolts

Mounted Infrared LED Laser Tag System
Intermediate
  • 67
  • 3

A laser tag system that uses flex sensors to control an infrared LED transmitter.

The Zen Tracker - The Future of Workplace Health
Intermediate
  • 2,151
  • 32

Full instructions

An IoT, lucky bamboo garden that ambiently tracks and graphs your daily activity, ensuring wealth, health, and happiness!

Ship IoT with the TI CC3100 and Google Sheets
Intermediate
  • 1,569
  • 23

Full instructions

Send Data Across Tasks with Energia and Galaxia
Intermediate
  • 903
  • 12

Full instructions

How to send data across tasks? Mailbox can help!

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog