Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge upstream changes #79

Merged
merged 10 commits into from
Mar 2, 2023
4 changes: 4 additions & 0 deletions hal_st/instantiations/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ target_include_directories(hal_st.instantiations PUBLIC

target_link_libraries(hal_st.instantiations PUBLIC
hal_st.stm32fxxx
hal_st.synchronous_stm32fxxx
infra.event
infra.timer
services.tracer
)

target_sources(hal_st.instantiations PRIVATE
Expand All @@ -21,4 +23,6 @@ target_sources(hal_st.instantiations PRIVATE
StmEventInfrastructure.hpp
StmTracerInfrastructure.cpp
StmTracerInfrastructure.hpp
TracingResetStm.cpp
TracingResetStm.hpp
)
13 changes: 13 additions & 0 deletions hal_st/instantiations/StmTracerInfrastructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ namespace main_
tracer.Trace() << "----------------------------------------------------------";
}

#if defined(STM32WB)
StmTracerInfrastructure::StmTracerInfrastructure(const Configuration& configuration, hal::SyncLpUart syncLpUart, bool loggingEnabled)
: traceUart(configuration.index, configuration.tx, syncLpUart)
, traceWriter(traceUart)
, alwaysEnabledTracerOutputStream(traceWriter)
, tracerOutputStream(GetStreamWriter(loggingEnabled), infra::noFail)
, alwaysEnabledTracer(alwaysEnabledTracerOutputStream)
, tracer(tracerOutputStream)
{
tracer.Trace() << "----------------------------------------------------------";
}
#endif

infra::StreamWriter& StmTracerInfrastructure::GetStreamWriter(bool loggingEnabled)
{
if (loggingEnabled)
Expand Down
4 changes: 3 additions & 1 deletion hal_st/instantiations/StmTracerInfrastructure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ namespace main_
};

StmTracerInfrastructure(const Configuration& configuration, bool loggingEnabled = true);

#if defined(STM32WB)
StmTracerInfrastructure(const Configuration& configuration, hal::SyncLpUart syncLpUart, bool loggingEnabled = true);
#endif
infra::StreamWriter& GetStreamWriter(bool loggingEnabled);

TimeKeeperStub timeKeeper;
Expand Down
8 changes: 8 additions & 0 deletions hal_st/instantiations/TracingResetStm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "hal_st/instantiations/TracingResetStm.hpp"

namespace main_
{
TracingResetStm::TracingResetStm(services::Tracer& tracer)
: reset(resetStm, tracer)
{}
}
21 changes: 21 additions & 0 deletions hal_st/instantiations/TracingResetStm.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef HAL_ST_TRACING_RESET_STM_HPP
#define HAL_ST_TRACING_RESET_STM_HPP

#include "hal_st/stm32fxxx/ResetStm.hpp"
#include "services/tracer/TracingReset.hpp"

namespace main_
{
struct TracingResetStm
rjaegers marked this conversation as resolved.
Show resolved Hide resolved
{
private:
hal::ResetStm resetStm;

public:
TracingResetStm(services::Tracer& tracer);

services::TracingReset reset;
};
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace hal
void TracingGapPeripheralSt::HandleHciDisconnectEvent(hci_event_pckt& eventPacket)
{
const auto disconnectEvt = reinterpret_cast<hci_disconnection_complete_event_rp0*>(eventPacket.data);
tracer.Trace() << "GapPeripheralSt::HandleHciDisconnectEvent handle = " << disconnectEvt->Connection_Handle;
tracer.Trace() << "GapPeripheralSt::HandleHciDisconnectEvent Handle = " << disconnectEvt->Connection_Handle;
tracer.Continue() << " : Reason = " << disconnectEvt->Reason;
GapPeripheralSt::HandleHciDisconnectEvent(eventPacket);
}

Expand Down
22 changes: 14 additions & 8 deletions hal_st/std_periph/default_init/DefaultClockSTM32WB55.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#include "DefaultClock.h"

/* The system Clock is configured as follow :
* System Clock source = HSE
* SYSCLK(Hz) = 32000000
* HCLK1(Hz) = 32000000 (max 64000000)
* System Clock source = PLL (HSI)
* SYSCLK(Hz) = 64000000
* HCLK1(Hz) = 64000000 (max 64000000)
* HCLK2(Hz) = 32000000 (max 32000000)
* HCLK4(Hz) = 32000000 (max 64000000)
* HCLK4(Hz) = 64000000 (max 64000000)
* AHB Prescaler = 1
* APB1 Prescaler = 1
* APB2 Prescaler = 1
Expand Down Expand Up @@ -38,20 +38,26 @@ void ConfigureDefaultClock(void)
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
RCC_OscInitStruct.PLL.PLLN = 8;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
HAL_RCC_OscConfig(&RCC_OscInitStruct);

/** Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK4|RCC_CLOCKTYPE_HCLK2
|RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSE;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.AHBCLK2Divider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.AHBCLK2Divider = RCC_SYSCLK_DIV2;
RCC_ClkInitStruct.AHBCLK4Divider = RCC_SYSCLK_DIV1;

HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1);
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3);
}
14 changes: 8 additions & 6 deletions hal_st/stm32fxxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ target_sources(hal_st.stm32fxxx PRIVATE
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:DacStm.hpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:DigitalToAnalogPinStm.cpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:DigitalToAnalogPinStm.hpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:DmaStm.cpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:DmaStm.hpp>
DmaStm.cpp
DmaStm.hpp
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:EthernetMacStm.cpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:EthernetMacStm.hpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:EthernetSmiStm.cpp>
Expand All @@ -52,8 +52,8 @@ target_sources(hal_st.stm32fxxx PRIVATE
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:QuadSpiStmDma.hpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:RandomDataGeneratorStm.cpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:RandomDataGeneratorStm.hpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:ResetStm.cpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:ResetStm.hpp>
ResetStm.cpp
ResetStm.hpp
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:SdRamStm.cpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:SdRamStm.hpp>
SpiDataSizeConfiguratorStm.cpp
Expand All @@ -72,12 +72,14 @@ target_sources(hal_st.stm32fxxx PRIVATE
UartStm.hpp
UartStmDma.cpp
UartStmDma.hpp
$<$<OR:$<STREQUAL:${TARGET_MCU},stm32wb55>,$<STREQUAL:${TARGET_MCU_FAMILY},stm32f7xx>>:UartStmDuplexDma.cpp>
$<$<OR:$<STREQUAL:${TARGET_MCU},stm32wb55>,$<STREQUAL:${TARGET_MCU_FAMILY},stm32f7xx>>:UartStmDuplexDma.hpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:UsbLinkLayerStm.cpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:UsbLinkLayerStm.hpp>
UniqueDeviceId.cpp
UniqueDeviceId.hpp
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:WatchDogStm.cpp>
$<$<NOT:$<STREQUAL:${TARGET_MCU},stm32wb55>>:WatchDogStm.hpp>
WatchDogStm.cpp
WatchDogStm.hpp
)

if ("${TARGET_MCU_VENDOR}" STREQUAL st)
Expand Down
Loading