Skip to content

Commit

Permalink
[#1] - add linker scripts and CMake meta
Browse files Browse the repository at this point in the history
  • Loading branch information
ilg-ul committed Feb 7, 2021
1 parent 0ae281a commit da94507
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ the STM32F407VG MCU.

This project provides the initialization code generated by CubeMX.

It is intended to be included in unit tests, which generally do not
need peripherals.

## Maintainer info

This page is addressed to developers who plan to include this package
Expand Down Expand Up @@ -91,7 +94,11 @@ at any time.

### Status

The STM32F4DISCOVERY support is fully functional.
The STM32F4DISCOVERY core support is fully functional.

### Limitations

Currently only the GPIO drivers are enabled.

### Build & integration info

Expand Down Expand Up @@ -138,11 +145,11 @@ TBD

#### Namespaces

TBD
- none

#### Classes

TBD
- none

### Examples

Expand All @@ -163,4 +170,4 @@ The original content is released under the
with all rights reserved to
[Liviu Ionescu](https://github.com/ilg-ul/).

The HAL code generated by CubeMX is distributed under BSD-3-Clause license.
The HAL code generated by CubeMX is distributed under the BSD-3-Clause license.
26 changes: 26 additions & 0 deletions linker-scripts/mem.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Memory Spaces Definitions for the STM32F4DISCOVERY board.
*
* FLASH.ORIGIN: starting address of flash
* FLASH.LENGTH: length of flash
* RAM.ORIGIN: starting address of RAM bank 0
* RAM.LENGTH: length of RAM bank 0
*
* The values below can be addressed in further linker scripts
* using functions like 'ORIGIN(RAM)' or 'LENGTH(RAM)'.
*/

MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K

/*
* Device specific sections; define the origin and length to match
* the the specific requirements of your hardware. The zero
* length prevents inadvertent allocation.
*/
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
MEMORY_ARRAY (xrw) : ORIGIN = 0x20020000, LENGTH = 32
}

129 changes: 129 additions & 0 deletions meta/xpack-helper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#
# This file is part of the µOS++ distribution.
# (https://github.com/micro-os-plus)
# Copyright (c) 2021 Liviu Ionescu
#
# This Source Code Form is subject to the terms of the MIT License.
# If a copy of the license was not distributed with this file, it can
# be obtained from https://opensource.org/licenses/MIT/.
#
# -----------------------------------------------------------------------------

message(STATUS "Including micro-os-plus-platform-stm32f4discovery...")

# Preprocessor symbols.
set(xpack_platform_compile_definition "PLATFORM_STM32F4DISCOVERY")
set(xpack_device_compile_definition "STM32F407xx")
set(xpack_device_family_compile_definition "STM32F4")

function(target_sources_micro_os_plus_platform_stm32f4discovery target)

get_filename_component(xpack_root_folder ${CMAKE_CURRENT_FUNCTION_LIST_DIR} DIRECTORY)

target_sources(
${target}

PRIVATE
${xpack_root_folder}/stm32cubemx/Core/Src/gpio.c
${xpack_root_folder}/stm32cubemx/Core/Src/main.c
${xpack_root_folder}/stm32cubemx/Core/Src/stm32f4xx_hal_msp.c
${xpack_root_folder}/stm32cubemx/Core/Src/stm32f4xx_it.c
${xpack_root_folder}/stm32cubemx/Core/Src/system_stm32f4xx.c

${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c
)

endfunction()

function(target_include_directories_micro_os_plus_platform_stm32f4discovery target)

get_filename_component(xpack_root_folder ${CMAKE_CURRENT_FUNCTION_LIST_DIR} DIRECTORY)

target_include_directories(
${target}

PRIVATE
${xpack_root_folder}/stm32cubemx/Core/Inc
${xpack_root_folder}/stm32cubemx/Drivers/CMSIS/Device/ST/STM32F4xx/Include
${xpack_root_folder}/stm32cubemx/Drivers/CMSIS/Include
${xpack_root_folder}/stm32cubemx/Drivers/STM32F4xx_HAL_Driver/Inc
)

endfunction()

function(target_compile_definitions_micro_os_plus_platform_stm32f4discovery target)

get_filename_component(xpack_root_folder ${CMAKE_CURRENT_FUNCTION_LIST_DIR} DIRECTORY)

target_compile_definitions(
${target}

PRIVATE
USE_HAL_DRIVER
)

endfunction()

function(target_options_micro_os_plus_platform_stm32f4discovery target)

get_filename_component(xpack_root_folder ${CMAKE_CURRENT_FUNCTION_LIST_DIR} DIRECTORY)

# TBD

endfunction()

# -----------------------------------------------------------------------------
# Forward device to devices-stm32f4.

function(target_sources_micro_os_plus_device target)

target_sources_micro_os_plus_devices_stm32f4(${target})

endfunction()


function(target_include_directories_micro_os_plus_device target)

target_include_directories_micro_os_plus_devices_stm32f4(${target})

endfunction()

# -----------------------------------------------------------------------------
# Forward architecture to architecture-cortexm.

function(target_sources_micro_os_plus_architecture target)

target_sources_micro_os_plus_architecture_cortexm(${target})

endfunction()


function(target_include_directories_micro_os_plus_architecture target)

target_include_directories_micro_os_plus_architecture_cortexm(${target})

endfunction()


function(target_compile_definitions_micro_os_plus_architecture target)

target_compile_definitions_micro_os_plus_architecture_cortexm(${target})

endfunction()

# -----------------------------------------------------------------------------

0 comments on commit da94507

Please sign in to comment.