Compare commits
7 commits
9343842eae
...
c43df6e576
| Author | SHA1 | Date | |
|---|---|---|---|
| c43df6e576 | |||
| cb8fa86c6f | |||
| 73a11f1abd | |||
| 120b0ba301 | |||
| b966fccf75 | |||
| a28d4dd937 | |||
| c0faa2322f |
6 changed files with 119 additions and 4 deletions
|
|
@ -1,9 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# Use the fancy version substitution
|
||||
project(cmake-cpputest-template
|
||||
project(main
|
||||
VERSION 1.0
|
||||
DESCRIPTION "template for cmake + cpputest"
|
||||
DESCRIPTION "STM32 template for cmake + cpputest"
|
||||
LANGUAGES C CXX
|
||||
)
|
||||
enable_testing()
|
||||
|
|
|
|||
2
Doxyfile
2
Doxyfile
|
|
@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8
|
|||
# title of most generated pages and in a few other places.
|
||||
# The default value is: My Project.
|
||||
|
||||
PROJECT_NAME = "My Project"
|
||||
PROJECT_NAME = "Project"
|
||||
|
||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
|
|
|
|||
27
README.md
27
README.md
|
|
@ -0,0 +1,27 @@
|
|||
# STM32 CMake+CppuTest Template
|
||||
|
||||
## Requirements
|
||||
|
||||
- An ARM compiler and linker.
|
||||
- Bash or a POSIX shell.
|
||||
- CMAKE version 3.20 or newer.
|
||||
- Cpputest 3.8 or newer.
|
||||
- Clangd LSP.
|
||||
- Git version control.
|
||||
|
||||
## Instructions
|
||||
|
||||
1. Clone/copy the repo locally.
|
||||
2. Check the requirements to make sure you're development enviroment is ready.
|
||||
3. Update the linker script files to target your current uC.
|
||||
|
||||
## Running Tests
|
||||
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] Create or copy a linker.ld file.
|
||||
- [ ] Add a startup file for at least the stm32f103c8t6.
|
||||
- [ ] Add messages for case where tool-chain is missing.
|
||||
- [ ] Check for FreeBSD & Linux compat.
|
||||
- [ ] Add in RTOS stuff.
|
||||
47
linker.ld
Normal file
47
linker.ld
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Filename: linker.ld
|
||||
* Micro-Controller: stm32f103c8t6
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Program Entry Point:
|
||||
* This part is put into the elf file header.
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
|
||||
/*
|
||||
* FORMAT:
|
||||
* R: Read only section.
|
||||
* W: Read/Write section.
|
||||
* X: Executable section.
|
||||
* A: Allocation section.
|
||||
* I: Initialized section.
|
||||
* !: Invert following attribute.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* MEMORY Format:
|
||||
* name [(attr)] : ORIGIN = origin, LENGTH = len
|
||||
*/
|
||||
|
||||
/* You will want to change these values to match your uC.*/
|
||||
MEMORY
|
||||
{
|
||||
FLASH(rx):ORIGIN =0x08000000,LENGTH =64K
|
||||
SRAM(rwx):ORIGIN =0x20000000,LENGTH =20K
|
||||
}
|
||||
|
||||
floating_point = 0;
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x10000;
|
||||
.text : { *(.text) }
|
||||
. = 0x8000000;
|
||||
.data : { *(.data) }
|
||||
.bss : { *(.bss) }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
add_executable(main
|
||||
add_executable(${PROJECT_NAME}
|
||||
main.c
|
||||
)
|
||||
|
||||
# Ensure the build rules are defined
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".elf")
|
||||
|
||||
|
||||
|
|
|
|||
36
stm32-toolchain.cmake
Normal file
36
stm32-toolchain.cmake
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# ###############################
|
||||
# STM32 toolchain file
|
||||
# ###############################
|
||||
|
||||
# Specify the cross-compiler
|
||||
set(CROSS_TOOLCHAIN arm-none-eabi-)
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
set(CMAKE_CROSSCOMPILING 1)
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
# Specify the exact Chip
|
||||
|
||||
|
||||
# Programmer and debugging
|
||||
set(PROGRAMMER serialupdi)
|
||||
set(PORT /dev/ttyU0)
|
||||
|
||||
|
||||
# Define the toolchain executables
|
||||
set(CMAKE_C_COMPILER avr-gcc)
|
||||
set(CMAKE_CXX_COMPILER avr-g++)
|
||||
set(CMAKE_ASM_COMPILER avr-gcc)
|
||||
set(CMAKE_LINKER avr-ld)
|
||||
set(CMAKE_OBJCOPY avr-objcopy)
|
||||
set(CMAKE_SIZE avr-size)
|
||||
|
||||
|
||||
|
||||
|
||||
# Define compile options
|
||||
set(CMAKE_C_FLAGS " -Os -mmcu=${AVR_MCU} -DF_CPU=${F_CPU}")
|
||||
set(CMAKE_CXX_FLAGS "-mmcu=${AVR_MCU} -DF_CPU=${F_CPU}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-mmcu=${AVR_MCU}")
|
||||
|
||||
|
||||
Loading…
Add table
Reference in a new issue