-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: update DmaStm to support new dma peripherals in G0, G4 and WB …
…devices (#169) * chore: added .cache folder to gitignore * chore: added vscode settings for compileCommands and clangd * chore: removed peripheral address from StreamBase * refactor: changed DmaStm to support stream and channel based dma peripherals * chore: fixed DmaStm typos * refactor: reworked DmaStm configuration lists for channel based dma peripherals * feat: added default clock config for g474 nucleo * refactor: reworkedexamples to match supported nucleo boards and added helloworld example * feat: added g474 linker script * build: added stm32g474 cmake configuration * chore: added stm32wb55 stlink-remote debug target * build: removed 144pin configuration from helloworld targets * refactor: cleaned up NucleoUi.hpp * refactor: removed old dma implementation * refactor: removed old default dma configurations * chore: removed obsolete comment * chore: moved code to correct location in header * refactor: separated template definitions and implementations * refactor: removed incorrect include * removed DacStm * fixed AnalogToDigitalPinStm to work with G4 devices * Fixed using incorrect register flag to determine FIFO/RX status * Reworked UartStmDuplexDma - properly handles ReceiveTimeoutInterrupt when DMA has wrapped around back to the beginning - removed code duplication * Added IsInterruptPending to DmaStm * fixed incorrect uartRts/uartCts initialization * chore: fixed missing cmakepresets build entries * chore: removed unused includes * chore: refactored UartStmDma to remove duplication * chore: remove duplication from UartStmDuplexDma * chore: updated formatting * chore: revert invalid comparison change * chore: added noexcept to DmaStm::Stream::move-ctor * feat: updated intialization of dma based peripherals, moved Uart*::Config to a detail namespace to workaround a default-ctor issue * chore: cat CMakePresets.json * chore: remove cat CMakePresets.json * chore: update CMakePresets.json * chore: resolved comments * feat: add SetPierpheralTransferSize to all DMA streams * fix: fixed SpiDataSizeConfiguratorStm not using the provided dataSize when activating the configuration * fix: fxed incorrect ISR flag check to determine if the uart fifo is empty * feat: added setting peripheral transfer size when changing the datasize for SpimasterStmDma periperhals * Fixed issue with ReceivedSize * feat: refactored DmaStm to remove all instances of CRTP and simplified all interfaces/inheritance trees * chore: updated EchoFromCloud with new Dma structure * chore: changed 1000ms to 1ms * hal_stl/stm32fxxx/UartStm: remove hwFlowControl from Config * hal_st/stm32fxxx: Rename DefalutClockNucleoG474RET to DefaultClockNucleoG474RE * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * hal_st/stm32fxxx/QuadSpiStmDma: rename transceiveStreamBase to transceiveStream * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * hal_st/instantiations/NucleoUi: Move UARTs to helloworld example --------- Co-authored-by: Richard Peters <richard@rpeters.org> Co-authored-by: Richard Peters <richard.peters@philips.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
eb44953
commit d62e03e
Showing
34 changed files
with
7,819 additions
and
640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.cache | ||
.vs/ | ||
.vscode/.cortex-debug* | ||
build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json", | ||
"sonarlint.pathToCompileCommands": "${workspaceFolder}/build/compile_commands.json", | ||
"clangd.arguments": ["--query-driver=/**/arm-none-eabi-*"], | ||
"C_Cpp.autoAddFileAssociations": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
add_subdirectory(blink) | ||
add_subdirectory(freertos) | ||
add_subdirectory(helloworld) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
add_executable(hal_st.helloworld_nucleo64 Main.cpp) | ||
emil_build_for(hal_st.helloworld_nucleo64 | ||
TARGET_MCU stm32g474 | ||
TARGET_MCU stm32wb55 | ||
PREREQUISITE_BOOL HALST_BUILD_EXAMPLES | ||
) | ||
|
||
target_compile_definitions(hal_st.helloworld_nucleo64 PUBLIC | ||
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:NUCLEO=Nucleo64Ui> | ||
$<$<STREQUAL:${TARGET_MCU},stm32wb55>:NUCLEO=Nucleo64WBUi> | ||
) | ||
|
||
target_link_libraries(hal_st.helloworld_nucleo64 PRIVATE | ||
services.util | ||
hal_st.instantiations | ||
) | ||
|
||
halst_target_default_linker_scripts(hal_st.helloworld_nucleo64) | ||
halst_target_default_init(hal_st.helloworld_nucleo64) | ||
|
||
emil_generate_artifacts(TARGET hal_st.helloworld_nucleo64 LST MAP BIN HEX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "hal/interfaces/Gpio.hpp" | ||
#include "hal_st/instantiations/NucleoUi.hpp" | ||
#include "hal_st/instantiations/StmEventInfrastructure.hpp" | ||
#include "infra/timer/Timer.hpp" | ||
#include "services/tracer/GlobalTracer.hpp" | ||
#include "services/tracer/StreamWriterOnSerialCommunication.hpp" | ||
#include "services/tracer/Tracer.hpp" | ||
#include "services/tracer/TracerWithDateTime.hpp" | ||
#include "services/util/DebugLed.hpp" | ||
#include <array> | ||
#include <chrono> | ||
|
||
unsigned int hse_value = 24'000'000; | ||
|
||
int main() | ||
{ | ||
HAL_Init(); | ||
|
||
static main_::StmEventInfrastructure eventInfrastructure; | ||
static main_::NUCLEO ui; | ||
static services::DebugLed debugLed(ui.ledGreen); | ||
static hal::DmaStm dmaStm; | ||
|
||
#if defined(STM32G0) || defined(STM32G4) | ||
static hal::GpioPinStm stLinkUartTxPin{ hal::Port::A, 2 }; | ||
static hal::GpioPinStm stLinkUartRxPin{ hal::Port::A, 3 }; | ||
static hal::DmaStm::TransmitStream transmitStream{ dmaStm, hal::DmaChannelId{ 1, 1, DMA_REQUEST_USART2_TX } }; | ||
static hal::UartStmDma stLinkUartDma{ transmitStream, 2, stLinkUartTxPin, stLinkUartRxPin }; | ||
#endif | ||
|
||
#if defined(STM32WB) | ||
static hal::GpioPinStm stLinkUartTxPin{ hal::Port::B, 6 }; | ||
static hal::GpioPinStm stLinkUartRxPin{ hal::Port::B, 7 }; | ||
static hal::DmaStm::TransmitStream transmitStream{ dmaStm, hal::DmaChannelId{ 1, 1, DMA_REQUEST_USART1_TX } }; | ||
static hal::UartStmDma stLinkUartDma{ transmitStream, 1, stLinkUartTxPin, stLinkUartRxPin }; | ||
#endif | ||
|
||
static services::StreamWriterOnSerialCommunication::WithStorage<64> streamWriterOnSerialCommunication{ stLinkUartDma }; | ||
static infra::TextOutputStream::WithErrorPolicy textOutputStream{ streamWriterOnSerialCommunication }; | ||
static services::TracerWithDateTime tracerWithDateTime{ textOutputStream }; | ||
|
||
services::SetGlobalTracerInstance(tracerWithDateTime); | ||
|
||
static infra::TimerRepeating timerRepeating{ std::chrono::seconds{ 1 }, [] | ||
{ | ||
services::GlobalTracer().Trace() << "Hello World !"; | ||
} }; | ||
|
||
eventInfrastructure.Run(); | ||
__builtin_unreachable(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include DEVICE_HEADER | ||
#include "hal_st/stm32fxxx/DefaultClockNucleoG474RE.hpp" | ||
|
||
/* The system Clock is configured as follows: | ||
* System Clock source = PLL (HSE) | ||
* SYSCLK(Hz) = 170,000,000 | ||
* HCLK(Hz) = 170,000,000 | ||
* AHB Prescaler = 1 | ||
* APB1 Prescaler = 1 | ||
* APB2 Prescaler = 1 | ||
* HSI Frequency(Hz) = 24MHz | ||
* VDD(V) = 3.3 | ||
* Main regulator output voltage = Scale1 mode | ||
*/ | ||
void ConfigureDefaultClockNucleo474RE() | ||
{ | ||
RCC_OscInitTypeDef RCC_OscInitStruct = { 0 }; | ||
RCC_ClkInitTypeDef RCC_ClkInitStruct = { 0 }; | ||
|
||
/** Configure the main internal regulator output voltage | ||
*/ | ||
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST); | ||
|
||
/** Initializes the RCC Oscillators according to the specified parameters | ||
* in the RCC_OscInitTypeDef structure. | ||
*/ | ||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; | ||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; | ||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; | ||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; | ||
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV6; | ||
RCC_OscInitStruct.PLL.PLLN = 85; | ||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; | ||
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; | ||
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; | ||
HAL_RCC_OscConfig(&RCC_OscInitStruct); | ||
|
||
/** Initializes the CPU, AHB and APB buses clocks | ||
*/ | ||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; | ||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; | ||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; | ||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; | ||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; | ||
|
||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef HAL_ST_DEFAULT_CLOCK_HPP | ||
#define HAL_ST_DEFAULT_CLOCK_HPP | ||
|
||
void ConfigureDefaultClockNucleo474RE(); | ||
|
||
#endif |
Oops, something went wrong.