diff --git a/README.md b/README.md index e90408c..46f7e13 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -138,11 +145,11 @@ TBD #### Namespaces -TBD +- none #### Classes -TBD +- none ### Examples @@ -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. diff --git a/linker-scripts/mem.ld b/linker-scripts/mem.ld new file mode 100644 index 0000000..69fd801 --- /dev/null +++ b/linker-scripts/mem.ld @@ -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 +} + diff --git a/meta/xpack-helper.cmake b/meta/xpack-helper.cmake new file mode 100644 index 0000000..a43c1fa --- /dev/null +++ b/meta/xpack-helper.cmake @@ -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() + +# ----------------------------------------------------------------------------- +