Skip to content

Commit 266bb8d

Browse files
committed
Add EEPROM driver for POSIX
Implements an IEepromDriver for POSIX based development and testing. Stores into a file instead of real EEPROM Change-Id: Ib98a55ca81a6522c425886b2d565daf2d82fb622
1 parent 37a1388 commit 266bb8d

File tree

15 files changed

+279
-4
lines changed

15 files changed

+279
-4
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# This is an empty module kept here because bspCharInputOutput is dependent on
2-
# this module.
31
add_library(bspConfiguration INTERFACE)
2+
3+
target_include_directories(bspConfiguration INTERFACE include)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright 2024 Accenture.
2+
3+
#pragma once
4+
5+
#define EEPROM_FILEPATH "/tmp/openbsw_posix_eeprom.bin"

executables/referenceApp/platforms/posix/main/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
add_library(main src/main.cpp)
1+
add_library(main src/main.cpp src/lifecycle/StaticBsp.cpp)
22

33
target_include_directories(main PRIVATE include)
44

5-
target_link_libraries(main PRIVATE asyncBinding lifecycle)
5+
target_link_libraries(main PRIVATE asyncBinding lifecycle bspEepromDriver)
66

77
add_library(osHooks src/osHooks.cpp)
88

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2024 Accenture.
2+
3+
#pragma once
4+
5+
#include "bsp/eeprom/IEepromDriver.h"
6+
#include "eeprom/EepromDriver.h"
7+
8+
class StaticBsp
9+
{
10+
public:
11+
StaticBsp() {}
12+
13+
void init();
14+
15+
eeprom::IEepromDriver& getEepromDriver() { return _eepromDriver; }
16+
17+
private:
18+
::eeprom::EepromDriver _eepromDriver;
19+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright 2024 Accenture.
2+
3+
#include "lifecycle/StaticBsp.h"
4+
5+
void StaticBsp::init() { _eepromDriver.init(); }

executables/referenceApp/platforms/posix/main/src/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright 2024 Accenture.
22

3+
#include "lifecycle/StaticBsp.h"
4+
35
#include <async/AsyncBinding.h>
46
#include <lifecycle/LifecycleManager.h>
57

@@ -19,6 +21,7 @@ extern void app_main();
1921

2022
namespace platform
2123
{
24+
StaticBsp staticBsp;
2225

2326
#ifdef PLATFORM_SUPPORT_CAN
2427
::estd::typed_mem<::systems::CanSystem> canSystem;
@@ -54,6 +57,7 @@ int main()
5457
signal(SIGINT, intHandler);
5558
main_thread_setup();
5659
terminal_setup();
60+
::platform::staticBsp.init();
5761
app_main(); // entry point for the generic part
5862
return (1); // we never reach this point
5963
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright 2024 Accenture.
2+
3+
#pragma once
4+
5+
#define EEPROM_FILEPATH "/tmp/openbsw_posix_eeprom_ut.bin"

platforms/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ if (NOT BUILD_UNIT_TESTS)
55
else ()
66
add_subdirectory(posix/bsp/socketCanTransceiver)
77
add_subdirectory(posix/bsp/socketCanTransceiver/test/gtest)
8+
add_subdirectory(posix/bsp/bspEepromDriver/test/gtest)
89
add_subdirectory(s32k1xx/bsp/bspCore/test/gtest)
910
add_subdirectory(s32k1xx/bsp/bspIo/test/gtest)
1011
add_subdirectory(s32k1xx/bsp/bspSci/test/gtest)

platforms/posix/bsp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ add_subdirectory(bspMcu)
33
add_subdirectory(bspStdio)
44
add_subdirectory(bspSystemTime)
55
add_subdirectory(socketCanTransceiver)
6+
add_subdirectory(bspEepromDriver)
67

78
add_library(socBsp INTERFACE)
89
target_link_libraries(socBsp INTERFACE bspInterruptsImpl bspMcu bspStdio
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
add_library(bspEepromDriver src/eeprom/EepromDriver.cpp)
2+
3+
target_include_directories(bspEepromDriver PUBLIC include)
4+
5+
target_link_libraries(bspEepromDriver PUBLIC bspConfiguration bsp)

0 commit comments

Comments
 (0)