~aleteoryx/muditaos

dcc72e0bec2f07d2f91810362e98e39edc23c53f — Lucjan Bryndza 5 years ago 067ca94
[EGD-5332] Fix heap size and other merge fixes

After merge with master we are unable to run any application
It was caused by the insufficent heap size
M board/linux/libiosyscalls/src/iosyscalls.cpp => board/linux/libiosyscalls/src/iosyscalls.cpp +0 -1
@@ 21,7 21,6 @@ namespace {
    constexpr const char * LINUX_PATHS[] {
        "/dev/",
        "/etc/",
        "/sys/.boot.json",
        "/usr/share",
        "/run/user",
        "/home",

M module-apps/application-settings-new/model/QuotesRepository.hpp => module-apps/application-settings-new/model/QuotesRepository.hpp +4 -3
@@ 10,6 10,7 @@

#include <list>
#include <functional>
#include <filesystem>
#include <module-apps/Application.hpp>

namespace app


@@ 48,9 49,9 @@ namespace app
        void remove(const QuoteRecord &quote) override;

      private:
        void writeQuotes(const fs::path &path);
        void readQuotes(const fs::path &fn);
        std::string readFileToString(const fs::path &fn);
        void writeQuotes(const std::filesystem::path &path);
        void readQuotes(const std::filesystem::path &fn);
        std::string readFileToString(const std::filesystem::path &fn);

        std::list<QuoteRecord> quotes;
        std::string repositoryPath;

M module-os/FreeRTOS/include/FreeRTOSConfig.h => module-os/FreeRTOS/include/FreeRTOSConfig.h +1 -1
@@ 80,7 80,7 @@ extern uint32_t SystemCoreClock;
#define configSUPPORT_STATIC_ALLOCATION         1
#define configSUPPORT_DYNAMIC_ALLOCATION        1
#ifdef TARGET_Linux
#   define configTOTAL_HEAP_SIZE                   ((size_t)(1024*373))
#   define configTOTAL_HEAP_SIZE                   ((size_t)(1024*512))
#else
#   define configTOTAL_HEAP_SIZE                   ((size_t)(1024*324))
#endif

M module-utils/bootconfig/src/bootconfig.cpp => module-utils/bootconfig/src/bootconfig.cpp +5 -14
@@ 9,6 9,7 @@
#include <time/time_conversion.hpp>
#include <ticks.hpp>
#include <cstdio>
#include <fstream>
#include <log/log.hpp>
#include <crc32/crc32.h>



@@ 101,20 102,10 @@ namespace boot
        }
        std::string loadFileAsString(const std::filesystem::path &fileToLoad)
        {
            auto lamb = [](::FILE *stream) { ::fclose(stream); };
            std::unique_ptr<char[]> readBuf(new char[boot::consts::tar_buf]);
            std::unique_ptr<::FILE, decltype(lamb)> fp(fopen(fileToLoad.c_str(), "r"), lamb);
            std::string contents;
            size_t readSize;

            if (fp.get() != nullptr) {
                while (!feof(fp.get())) {
                    readSize = fread(readBuf.get(), 1, boot::consts::tar_buf, fp.get());
                    contents.append(static_cast<const char *>(readBuf.get()), readSize);
                }
            }

            return contents;
            std::string content;
            std::ifstream in(fileToLoad);
            std::getline(in, content, std::string::traits_type::to_char_type(std::string::traits_type::eof()));
            return content;
        }

    } // namespace