From 32de9ec671db9ddaf68a61d7a53f6a971f45f75d Mon Sep 17 00:00:00 2001 From: Lucjan Bryndza Date: Thu, 7 Jan 2021 12:56:52 +0100 Subject: [PATCH] [EGD-5102] Fix compile on rt1051 platform It is initial commmit which fix compilation after vfs. global object removal. It still need implementation newlib syscalls. --- board/rt1051/newlib/io_syscalls.cpp | 5 + .../bsp/battery-charger/battery_charger.cpp | 7 +- module-bsp/board/rt1051/bsp/usb | 2 +- .../endpoints/factoryReset/FactoryReset.cpp | 10 +- module-utils/bootconfig/src/bootconfig.cpp | 1 + .../purefs/src/vfs_subsystem_internal.cpp | 14 + .../drivers/src/purefs/fs/filesystem_vfat.cpp | 2 +- .../internal/newlib/vfs_io_syscalls.hpp | 3 + module-vfs/src/newlib/vfs_internal_dirent.cpp | 60 +-- module-vfs/src/newlib/vfs_io_syscalls.cpp | 381 ++---------------- module-vfs/targets/Target_RT1051.cmake | 1 + 11 files changed, 61 insertions(+), 425 deletions(-) create mode 100644 module-vfs/board/rt1051/purefs/src/vfs_subsystem_internal.cpp diff --git a/board/rt1051/newlib/io_syscalls.cpp b/board/rt1051/newlib/io_syscalls.cpp index 679c850aa8db3b0af1717b8dc1e7d8a26cba29fb..bcf3067d0545869615633251c5ad0b2c05c965ba 100644 --- a/board/rt1051/newlib/io_syscalls.cpp +++ b/board/rt1051/newlib/io_syscalls.cpp @@ -7,6 +7,7 @@ #include #include #include +#include extern "C" { using namespace vfsn::internal; @@ -109,5 +110,9 @@ extern "C" int fsync( int fd ) { return syscalls::fsync(_REENT->_errno, fd); } + int statvfs(const char *path, struct statvfs *buf) + { + return syscalls::statvfs(path,buf); + } } diff --git a/module-bsp/board/rt1051/bsp/battery-charger/battery_charger.cpp b/module-bsp/board/rt1051/bsp/battery-charger/battery_charger.cpp index b0426de1017a2a68aaeb75b778b7545c941fcf80..84b5953b24b332727fdf3ccd9aba0aa00e39cefa 100644 --- a/module-bsp/board/rt1051/bsp/battery-charger/battery_charger.cpp +++ b/module-bsp/board/rt1051/bsp/battery-charger/battery_charger.cpp @@ -16,7 +16,6 @@ extern "C" } #include "bsp/battery-charger/battery_charger.hpp" -#include "vfs.hpp" #include "bsp/BoardDefinitions.hpp" #include "common_data/EventStore.hpp" @@ -24,7 +23,7 @@ extern "C" #include "drivers/i2c/DriverI2C.hpp" #include #include - +#include "fsl_common.h" #define BSP_BATTERY_CHARGER_I2C_ADDR (0xD2 >> 1) #define BSP_FUEL_GAUGE_I2C_ADDR (0x6C >> 1) #define BSP_TOP_CONTROLLER_I2C_ADDR (0xCC >> 1) @@ -336,6 +335,8 @@ static int battery_chargerTopControllerWrite(bsp::batteryChargerRegisters regist } } +static int battery_chargerTopControllerRead(bsp::batteryChargerRegisters registerAddress, uint8_t *value) + __attribute__((used)); static int battery_chargerTopControllerRead(bsp::batteryChargerRegisters registerAddress, uint8_t *value) { if (value == NULL) { @@ -389,7 +390,7 @@ static bsp::batteryRetval battery_loadConfiguration(void) static bsp::batteryRetval battery_storeConfiguration(void) { // TODO:M.P procedure below seems to crash system, it should be fixed. - if (ff_rename(configs::battery_cfgFile.c_str(), configs::battery_cfgFilePrev.c_str(), false) != 0) { + if (rename(configs::battery_cfgFile.c_str(), configs::battery_cfgFilePrev.c_str()) != 0) { LOG_ERROR("Could not move configuration file"); return bsp::batteryRetval::battery_ChargerError; } diff --git a/module-bsp/board/rt1051/bsp/usb b/module-bsp/board/rt1051/bsp/usb index bd86bc1e7f464b81746bee08997f8f7adefb99d7..43e882e21180a7fceb724a43aa0f72850bbb4a22 160000 --- a/module-bsp/board/rt1051/bsp/usb +++ b/module-bsp/board/rt1051/bsp/usb @@ -1 +1 @@ -Subproject commit bd86bc1e7f464b81746bee08997f8f7adefb99d7 +Subproject commit 43e882e21180a7fceb724a43aa0f72850bbb4a22 diff --git a/module-services/service-desktop/endpoints/factoryReset/FactoryReset.cpp b/module-services/service-desktop/endpoints/factoryReset/FactoryReset.cpp index b8c2116a6bdece6a5b9a03936051de9611f171dc..8c2d17b5e3e4aed974e6ecc96d604222e34f14d0 100644 --- a/module-services/service-desktop/endpoints/factoryReset/FactoryReset.cpp +++ b/module-services/service-desktop/endpoints/factoryReset/FactoryReset.cpp @@ -2,9 +2,6 @@ // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "FactoryReset.hpp" -#ifndef TARGET_Linux -#include -#endif #include #include #include @@ -17,6 +14,7 @@ #include #include #include +#include namespace sys { @@ -36,11 +34,7 @@ namespace FactoryReset static const int max_recurse_depth = 120; /* 120 is just an arbitrary value of max number of recursive calls. * If more then error is assumed, not the real depth of directories." */ -#ifdef TARGET_Linux - static const int max_filepath_length = 4096; -#else - static const int max_filepath_length = ffconfigMAX_FILENAME; -#endif + static const int max_filepath_length = PATH_MAX; bool Run(sys::Service *ownerService) { diff --git a/module-utils/bootconfig/src/bootconfig.cpp b/module-utils/bootconfig/src/bootconfig.cpp index 5ed5cb392aa3519d51a1480e297480e22b1960aa..27350ad7f2e11893cbb79a73ab0ea93edd7d4d62 100644 --- a/module-utils/bootconfig/src/bootconfig.cpp +++ b/module-utils/bootconfig/src/bootconfig.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include