Skip to content

Commit

Permalink
Add BUILD scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
clydebarrow committed Apr 4, 2017
1 parent 2519e55 commit 462099f
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 5 deletions.
7 changes: 7 additions & 0 deletions app/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# To build this project, run these commands:
# Build the Debug version
mkdir -p build-debug && cd build-debug && cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=EFR32BG1.cmake .. && make
cd ..
#
# Build the release version
mkdir -p build-release && cd build-release && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=EFR32BG1.cmake .. && make
2 changes: 1 addition & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set(FMW_FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.fmw)
file(GLOB_RECURSE USER_SOURCES "src/*.c")
file(GLOB_RECURSE USER_HEADERS "inc/*.h")
file(STRINGS ${OTA_SERVICE_UUID_FILE} OTA_SERVICE)
file(STRINGS ${OTA_KEY_FILE} OTA_KEY)
file(STRINGS ${OTA_KEY_FILE} OTA_KEY LIMIT_INPUT 64)

IF (CMAKE_BUILD_TYPE MATCHES Debug)
file(GLOB_RECURSE RTT_LIBS "libs/SEGGER_RTT_V612j/RTT/*.c")
Expand Down
5 changes: 5 additions & 0 deletions bootload/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To build this project, run these commands:
mkdir -p build-debug && cd build-debug && cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=EFR32BG1.cmake .. && make
cd ..
#
mkdir -p build-release && cd build-release && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=EFR32BG1.cmake .. && make
2 changes: 2 additions & 0 deletions bootload/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.6)
project(bgbootload)

set(GCC_PREFIX arm-none-eabi)
set(CMAKE_CXX_COMPILER ${GCC_PREFIX}/-gcc)
set(CMAKE_C_STANDARD 99)
add_definitions(-D__NO_SYSTEM_INIT)
add_definitions(-DEFR32BG1B232F256GM48)
Expand Down
7 changes: 3 additions & 4 deletions bootload/EFR32BG1.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
INCLUDE(CMakeForceCompiler)

SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_VERSION 1)

Expand All @@ -12,10 +11,10 @@ find_path(GCC_DIR bin/${GCC_PREFIX}-gcc

set(OBJSIZE ${GCC_DIR}/bin/${GCC_PREFIX}-size)
# specify the cross compiler
CMAKE_FORCE_C_COMPILER(${GCC_DIR}/bin/-gcc GNU)
CMAKE_FORCE_C_COMPILER(${GCC_DIR}/bin/${GCC_PREFIX}-gcc GNU)
CMAKE_FORCE_CXX_COMPILER(${GCC_DIR}/bin/${GCC_PREFIX}-g++ GNU)

# These flags are appropriate for the SiLabs EFR32BG series chips
SET(COMMON_FLAGS "-mcpu=cortex-m4 -mthumb -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -g -fno-common -fmessage-length=0")
SET(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11")
SET(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
SET(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11" CACHE STRING "" FORCE)
SET(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99" CACHE STRING "" FORCE)
5 changes: 5 additions & 0 deletions utils/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To build this project, run these commands:
mkdir -p build-debug && cd build-debug && cmake -DCMAKE_BUILD_TYPE=Debug .. && make
cd ..
#
mkdir -p build-release && cd build-release && cmake -DCMAKE_BUILD_TYPE=Release .. && make
5 changes: 5 additions & 0 deletions utils/elf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//
// Created by Clyde Stubbs on 4/4/17.
//

#include "elf.h"
42 changes: 42 additions & 0 deletions utils/elf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// Created by Clyde Stubbs on 4/4/17.
//

#ifndef UTILS_ELF_H
#define UTILS_ELF_H

typedef struct {
uint8 magic[4];
uint8 wordsize; // 1 = 32bit, 2 = 64 bit
uint8 endianness; // 1 == little, 2 = big
uint8 elfVer; // 1
uint8 system;
uint8 abiversion;
uint8 pad[7];
uint8 type[2];
uint8 isa[2]; // arm = 0x28
uint8 elfVer2[4];
uint8 entry[4];
uint8 phoff[4];
uint8 shoff[4];
uint8 flags[4];
uint8 ehsize[2];
uint8 phentsize[2];
uint8 phnum[2];
uint8 shentsize[2];
uint8 shnum[2];
uint8 shstrndx[2];

} elf_file_header;

typedef struct {
uint8 type[4]; // 1 = LOAD
uint8 offset[4];
uint8 vaddr[4];
uint8 paddr[4];
uint8 filesz[4];
uint8 memsz[4];
uint8 flags[4];
uint8 align[4];
} elf_program_header;
#endif //UTILS_ELF_H

0 comments on commit 462099f

Please sign in to comment.