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

Switch from ESTD to ETL #58

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f19c74d
Switch from ESTD to ETL
rolandreichweinbmw Nov 15, 2024
99906e6
Use new remove interface of etl::intrusive_forward_list
rolandreichweinbmw Feb 9, 2025
8be9ba2
Reintroduced singleton as singleton_base
rolandreichweinbmw Feb 9, 2025
f906b5f
Reformat via treefmt
rolandreichweinbmw Feb 9, 2025
9741d6a
Adjust to newer ETL interfaces
rolandreichweinbmw Feb 10, 2025
039e776
Reformat with treefmt
rolandreichweinbmw Feb 10, 2025
be8a594
Using ::etl::equal() for span comparison
rolandreichweinbmw Feb 10, 2025
c91d946
Use ::etl::copy() for spans
rolandreichweinbmw Feb 10, 2025
124c6a9
Use etl::make_span()
rolandreichweinbmw Feb 10, 2025
d075aa6
Simplify usage of etl::unaligned_type interface
rolandreichweinbmw Feb 10, 2025
fbae275
Use newer ETL interfaces
rolandreichweinbmw Feb 11, 2025
22dad8c
Use new ETL interfaces
rolandreichweinbmw Feb 12, 2025
223eab9
Reformat w/ treefmt
rolandreichweinbmw Feb 12, 2025
2c6868e
Use new ETL interfaces
rolandreichweinbmw Feb 13, 2025
2810084
Use new ETL interfaces
rolandreichweinbmw Feb 17, 2025
7b1c9c1
Adjust to original .push_back() usage
rolandreichweinbmw Feb 18, 2025
870c6a8
Lambda setup
rolandreichweinbmw Feb 19, 2025
57f2d74
Fix format via treefmt
rolandreichweinbmw Feb 19, 2025
9dbdda1
Temporarily revert back to estd function and closure
rolandreichweinbmw Feb 19, 2025
bde7dba
Clean up remaining estd/functional.h
rolandreichweinbmw Feb 19, 2025
18c55db
Adjust to new estd use
rolandreichweinbmw Feb 21, 2025
cefb0c4
Updated ETL from upstream
rolandreichweinbmw Feb 28, 2025
3da1792
Fixed format via treefmt
rolandreichweinbmw Feb 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion executables/referenceApp/application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ target_link_libraries(
asyncConsole
bspMcu
configuration
estd
etl
lifecycle
consoleCommands
logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <docan/datalink/DoCanFrameCodec.h>
#include <docan/transmitter/IDoCanTickGenerator.h>
#include <docan/transport/DoCanTransportLayerContainer.h>
#include <etl/vector.h>
#include <lifecycle/AsyncLifecycleComponent.h>

namespace can
Expand Down Expand Up @@ -101,7 +102,7 @@ class DoCanSystem final
::docan::DoCanParameters _parameters;
::docan::declare::DoCanTransportLayerConfig<DataLinkLayerType, 80U, 15U, 64U>
_transportLayerConfig;
::estd::declare::vector<DoCanPhysicalCanTransceiver<AddressingType>, NUM_CAN_TRANSPORT_LAYERS>
::etl::vector<DoCanPhysicalCanTransceiver<AddressingType>, NUM_CAN_TRANSPORT_LAYERS>
_physicalTransceivers;
TransportLayers _transportLayers;
TickGeneratorRunnableAdapter _tickGenerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
#ifndef GUARD_FACE7DDD_046B_4B7B_B83F_6212136CBA2E
#define GUARD_FACE7DDD_046B_4B7B_B83F_6212136CBA2E

#include <etl/singleton_base.h>
#include <lifecycle/AsyncLifecycleComponent.h>
#include <transport/ITransportMessageProvider.h>
#include <transport/ITransportSystem.h>
#include <transport/routing/TransportRouterSimple.h>

#include <estd/singleton.h>

namespace transport
{
class AbstractTransportLayer;

class TransportSystem
: public ::estd::singleton<TransportSystem>
: public ::etl::singleton_base<TransportSystem>
, public ::transport::ITransportSystem
, public ::lifecycle::AsyncLifecycleComponent
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <async/Async.h>
#include <async/IRunnable.h>
#include <etl/singleton_base.h>
#include <lifecycle/AsyncLifecycleComponent.h>
#include <uds/DiagDispatcher.h>
#include <uds/DummySessionPersistence.h>
Expand All @@ -23,8 +24,6 @@
#include <uds/services/testerpresent/TesterPresent.h>
#include <uds/services/writedata/WriteDataByIdentifier.h>

#include <estd/singleton.h>

namespace lifecycle
{
class LifecycleManager;
Expand All @@ -39,11 +38,9 @@ namespace uds
{
class UdsSystem
: public lifecycle::AsyncLifecycleComponent
, public ::estd::singleton<UdsSystem>
, public ::etl::singleton_base<UdsSystem>
, private ::async::IRunnable
{
using Base = ::estd::singleton<UdsSystem>;

public:
UdsSystem(
lifecycle::LifecycleManager& lManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
#ifndef GUARD_DC726F41_1EE2_4343_818F_8A2F855AB88F
#define GUARD_DC726F41_1EE2_4343_818F_8A2F855AB88F

#include "estd/array.h"
#include "estd/slice.h"
#include "estd/uncopyable.h"
#include "platform/estdint.h"
#include "uds/jobs/DataIdentifierJob.h"

namespace uds
{
class ReadIdentifierPot : public DataIdentifierJob
{
UNCOPYABLE(ReadIdentifierPot);

public:
ReadIdentifierPot(DiagSessionMask const sessionMask = DiagSession::ALL_SESSIONS());

Expand Down
19 changes: 11 additions & 8 deletions executables/referenceApp/application/src/app/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "app/app.h"

#include "console/console.h"
#include "estd/typed_mem.h"
#include "logger/logger.h"
#include "reset/softwareSystemReset.h"
#include "systems/DemoSystem.h"
Expand All @@ -12,6 +11,8 @@
#include "systems/SysAdminSystem.h"

#include <app/appConfig.h>
#include <etl/alignment.h>
#include <etl/singleton.h>

#ifdef PLATFORM_SUPPORT_UDS
#include "busid/BusId.h"
Expand All @@ -30,6 +31,8 @@
#ifdef PLATFORM_SUPPORT_CAN
#include <systems/ICanSystem.h>

#include <cstdio>

namespace systems
{
extern ::can::ICanSystem& getCanSystem();
Expand Down Expand Up @@ -70,21 +73,21 @@ LifecycleManager lifecycleManager{
TASK_SYSADMIN,
::lifecycle::LifecycleManager::GetTimestampType::create<&getSystemTimeUs32Bit>()};

::estd::typed_mem<::systems::RuntimeSystem> runtimeSystem;
::estd::typed_mem<::systems::SysAdminSystem> sysAdminSystem;
::estd::typed_mem<::systems::DemoSystem> demoSystem;
::estd::typed_mem<::systems::SafetySystem> safetySystem;
::etl::typed_storage<::systems::RuntimeSystem> runtimeSystem;
::etl::typed_storage<::systems::SysAdminSystem> sysAdminSystem;
::etl::typed_storage<::systems::DemoSystem> demoSystem;
::etl::typed_storage<::systems::SafetySystem> safetySystem;

#ifdef PLATFORM_SUPPORT_UDS
::estd::typed_mem<::transport::TransportSystem> transportSystem;
::etl::typed_storage<::transport::TransportSystem> transportSystem;
#endif

#ifdef PLATFORM_SUPPORT_CAN
::estd::typed_mem<::docan::DoCanSystem> doCanSystem;
::etl::typed_storage<::docan::DoCanSystem> doCanSystem;
#endif

#ifdef PLATFORM_SUPPORT_UDS
::estd::typed_mem<::uds::UdsSystem> udsSystem;
::etl::typed_storage<::uds::UdsSystem> udsSystem;
#endif

class LifecycleMonitor : private ::lifecycle::ILifecycleListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include "app/DemoLogger.h"

#include <bsp/SystemTime.h>

#include <estd/big_endian.h>
#include <etl/unaligned_type.h>
#ifdef PLATFORM_SUPPORT_CAN
#include <can/transceiver/AbstractCANTransceiver.h>
#endif
Expand Down Expand Up @@ -118,9 +117,8 @@ void DemoSystem::cyclic()
if (canTransceiver != nullptr)
{
// Logger::debug(DEMO, "Sending frame %d", canSentCount);
uint8_t canData[4] = {0};
::estd::write_be(canData, canSentCount);
::can::CANFrame frame(0x558, canData, 4);
etl::be_uint32_t canData{canSentCount};
::can::CANFrame frame(0x558, static_cast<uint8_t*>(canData.data()), 4);
canTransceiver->write(frame);
++canSentCount;
}
Expand Down
28 changes: 15 additions & 13 deletions executables/referenceApp/application/src/systems/DoCanSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <bsp/timer/SystemTimer.h>
#include <docan/common/DoCanLogger.h>
#include <docan/datalink/DoCanFrameCodecConfigPresets.h>
#include <etl/delegate.h>
#include <etl/span.h>

namespace
{
Expand Down Expand Up @@ -46,7 +48,7 @@ DoCanSystem::DoCanSystem(
, _classicCodec(::docan::DoCanFrameCodecConfigPresets::PADDED_CLASSIC, _frameSizeMapper)
, _classicAddressingFilter()
, _parameters(
::estd::function<decltype(systemUs)>::create<&systemUs>(),
::etl::delegate<decltype(systemUs)>::create<&systemUs>(),
ALLOCATE_TIMEOUT,
RX_TIMEOUT,
TX_CALLBACK_TIMEOUT,
Expand All @@ -69,25 +71,25 @@ void DoCanSystem::initLayer()
auto& transceiver = *_canSystem.getCanTransceiver(::busid::CAN_0);

::docan::DoCanPhysicalCanTransceiver<AddressingType>& doCanTransceiver
= _physicalTransceivers.emplace_back().construct(
::estd::by_ref(transceiver),
::estd::by_ref(_classicAddressingFilter),
::estd::by_ref(_classicAddressingFilter),
::estd::by_ref(_addressing));
= _physicalTransceivers.emplace_back(
::etl::ref(transceiver),
::etl::ref(_classicAddressingFilter),
::etl::ref(_classicAddressingFilter),
::etl::ref(_addressing));

_transportLayers.createTransportLayer().construct(
_transportLayers.emplace_back(
::busid::CAN_0,
::estd::by_ref(_context),
::estd::by_ref(_classicAddressingFilter),
::estd::by_ref(doCanTransceiver),
::estd::by_ref(_tickGenerator),
::estd::by_ref(_transportLayerConfig),
::etl::ref(_context),
::etl::ref(_classicAddressingFilter),
::etl::ref(doCanTransceiver),
::etl::ref(_tickGenerator),
::etl::ref(_transportLayerConfig),
::util::logger::DOCAN);
}

void DoCanSystem::init()
{
_classicAddressingFilter.init(::estd::make_slice(_addresses), ::estd::make_slice(_codecs));
_classicAddressingFilter.init(::etl::make_span(_addresses), ::etl::make_span(_codecs));

initLayer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace transport
{
TransportSystem::TransportSystem(::async::ContextType transitionContext)
: ::estd::singleton<TransportSystem>(*this)
: ::etl::singleton_base<TransportSystem>(*this)
{
// Tell the lifecycle manager in which context to execute init/run/shutdown
setTransitionContext(transitionContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#include <uds/UdsLogger.h>

#include <estd/type_traits.h>

namespace uds
{
using ::util::logger::Logger;
Expand All @@ -26,7 +24,7 @@ UdsSystem::UdsSystem(
::async::ContextType context,
uint16_t udsAddress)
: AsyncLifecycleComponent()
, ::estd::singleton<UdsSystem>(*this)
, ::etl::singleton_base<UdsSystem>(*this)
, _udsLifecycleConnector(lManager)
, _transportSystem(transportSystem)
, _jobRoot()
Expand Down
17 changes: 5 additions & 12 deletions executables/referenceApp/application/src/uds/ReadIdentifierPot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "uds/ReadIdentifierPot.h"

#include "estd/big_endian.h"
#include <etl/unaligned_type.h>
#ifdef PLATFORM_SUPPORT_IO
#include "bsp/adc/AnalogInputScale.h"
#include "outputPwm/OutputPwm.h"
Expand All @@ -11,9 +11,6 @@
#include "uds/UdsLogger.h"
#include "uds/connection/IncomingDiagConnection.h"

using ::estd::array;
using ::estd::slice;

namespace uds
{
using ::util::logger::Logger;
Expand All @@ -25,8 +22,6 @@ using bios::AnalogInputScale;
using bios::OutputPwm;
#endif

using ::estd::slice;

ReadIdentifierPot::ReadIdentifierPot(DiagSessionMask const sessionMask)
: DataIdentifierJob(_implementedRequest, sessionMask)
{
Expand All @@ -42,17 +37,15 @@ DiagReturnCode::Type ReadIdentifierPot::process(
PositiveResponse& response = connection.releaseRequestGetResponse();

uint32_t adcValue = 0x00000002;
uint8_t responseData22Cf02[4];

#ifdef PLATFORM_SUPPORT_IO
(void)AnalogInputScale::get(AnalogInput::AiEVAL_POTI_ADC, adcValue);
#endif

::estd::write_be(&responseData22Cf02[0], adcValue);

::estd::slice<uint8_t> _responseSlice(responseData22Cf02);

(void)response.appendData(_responseSlice.data(), static_cast<uint16_t>(_responseSlice.size()));
::etl::be_int32_t responseData22Cf02(adcValue);
(void)response.appendData(
static_cast<uint8_t*>(responseData22Cf02.data()),
static_cast<uint16_t>(responseData22Cf02.size()));
(void)connection.sendPositiveResponseInternal(response.getLength(), *this);

return DiagReturnCode::OK;
Expand Down
2 changes: 0 additions & 2 deletions executables/referenceApp/configuration/include/busid/BusId.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

#include "common/busid/BusId.h"

#include <estd/optional.h>

#include <cstdint>

namespace busid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
#define GUARD_3426A8C5_0A38_4B74_BE74_D069EB452DF0

#include <async/AsyncBinding.h>
#include <etl/optional.h>
#include <runtime/StatisticsContainer.h>
#include <util/command/GroupCommand.h>

#include <estd/optional.h>

namespace lifecycle
{
class StatisticsCommand : public ::util::command::GroupCommand
Expand Down Expand Up @@ -36,7 +35,7 @@ class StatisticsCommand : public ::util::command::GroupCommand
TaskStatistics _taskStatistics;
IsrGroupStatistics _isrGroupStatistics;

::estd::optional<uint32_t> _ticksPerUs;
::etl::optional<uint32_t> _ticksPerUs;
uint32_t _totalRuntime;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

#include <async/Async.h>
#include <lifecycle/ILifecycleManager.h>

#include <estd/assert.h>
#include <util/estd/assert.h>

namespace
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include <runtime/StatisticsWriter.h>
#include <util/format/SharedStringWriter.h>

#include <estd/assert.h>

namespace
{
void format(
Expand All @@ -26,7 +24,7 @@ void printCpu(
::util::command::CommandContext& context,
T const& taskStatistics,
I const& isrGroupStatistics,
::estd::optional<uint32_t> const& ticksPerUs,
::etl::optional<uint32_t> const& ticksPerUs,
uint32_t const totalRuntime)
{
::util::format::SharedStringWriter writer(context);
Expand Down
5 changes: 2 additions & 3 deletions executables/referenceApp/platforms/posix/main/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright 2024 Accenture.

#include <async/AsyncBinding.h>
#include <etl/alignment.h>
#include <lifecycle/LifecycleManager.h>

#include <estd/typed_mem.h>

#include <signal.h>
#include <unistd.h>

Expand All @@ -21,7 +20,7 @@ namespace platform
{

#ifdef PLATFORM_SUPPORT_CAN
::estd::typed_mem<::systems::CanSystem> canSystem;
::etl::typed_storage<::systems::CanSystem> canSystem;
#endif // PLATFORM_SUPPORT_CAN

void platformLifecycleAdd(::lifecycle::LifecycleManager& lifecycleManager, uint8_t const level)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ target_link_libraries(
bspMcuWatchdog
canflex2Transceiver
configuration
etl
freeRtosCm4SysTick
lifecycle
startUp
Expand Down
Loading
Loading