Skip to content

Commit 2f42cd5

Browse files
Mateusz Piestaswichu91
Mateusz Piesta
authored andcommitted
[BH-1424] FreeRTOS update
Updated FreeRTOS source code to 10.4.6. Moved FreeRTOS sources to the third-party directory. Added necessary changes to the CMake configuration. Split FreeRTOSConfig.h. From now, each board has its own. Added missing log headers. Minor refactor of the module-os cmake. Fixed stack overflows in bell application main and time service.
1 parent cc02fff commit 2f42cd5

File tree

108 files changed

+191
-37303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+191
-37303
lines changed

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,7 @@
109109
[submodule "third-party/msgpack11/msgpack11"]
110110
path = third-party/msgpack11/msgpack11
111111
url = https://github.com/ar90n/msgpack11.git
112+
[submodule "third-party/freeRTOS-kernel/freeRTOS-kernel"]
113+
path = third-party/freeRTOS-kernel/freeRTOS-kernel
114+
url = ../FreeRTOS-Kernel.git
115+
branch = mudita

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ if (NOT ENABLE_SECURE_BOOT)
121121
)
122122
endif ()
123123

124-
add_subdirectory(third-party)
125124
add_subdirectory(board)
126125
add_subdirectory(source)
127126
add_subdirectory(module-platform)
@@ -139,6 +138,7 @@ add_subdirectory(module-apps)
139138
add_subdirectory(module-bluetooth)
140139
add_subdirectory(image)
141140
add_subdirectory(host-tools)
141+
add_subdirectory(third-party)
142142

143143
include(tools/clang-tidy.cmake)
144144

Target_RT1051.cmake

-8
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ add_compile_options(
5757
$<$<COMPILE_LANGUAGE:CXX>:-Wno-literal-suffix>
5858
)
5959

60-
set(TARGET_SOURCES
61-
62-
${CMAKE_CURRENT_LIST_DIR}/module-os/board/rt1051/_exit.cpp
63-
${CMAKE_CURRENT_LIST_DIR}/module-os/board/rt1051/__atexit.c
64-
${CMAKE_CURRENT_LIST_DIR}/module-os/board/rt1051/__call_atexit.c
65-
CACHE INTERNAL ""
66-
)
67-
6860
# where is the target environment
6961
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_PATH}/${TOOLCHAIN_PREFIX})
7062
# search for programs in the build host directories

board/rt1051/ldscripts/sections.ld

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ SECTIONS
8787
{
8888
*(NonCacheable)
8989
*(COMMON)
90+
*libfreertos_kernel.a:*(.bss*)
9091
*libmodule-os.a:*(.bss*)
9192
*libmodule-sys.a:*(.bss*)
9293
*libmodule-bsp.a:*(.bss*)

module-audio/Audio/StreamFactory.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "transcode/TransformFactory.hpp"
88

99
#include <Math.hpp>
10+
#include <log/log.hpp>
1011

1112
#include <algorithm>
1213
#include <chrono>

module-audio/Audio/StreamQueuedEventsListener.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "StreamQueuedEventsListener.hpp"
55

66
#include <macros.h>
7+
#include <log/log.hpp>
78

89
#include <utility>
910

module-audio/board/rt1051/SAIAudioDevice.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "SAIAudioDevice.hpp"
55

66
#include <Audio/Stream.hpp>
7+
#include <log/log.hpp>
78

89
#include <cmath>
910

module-bsp/board/linux/hal/battery_charger/BatteryCharger.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <sys/stat.h>
99
#include <fcntl.h>
10+
#include <unistd.h>
1011

1112
namespace hal::battery
1213
{

module-bsp/board/linux/hal/key_input/KeyInput.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <sys/stat.h>
88
#include <fcntl.h>
99
#include <sys/epoll.h>
10+
#include <unistd.h>
11+
#include <cstdio>
1012

1113
namespace hal::key_input
1214
{

module-bsp/board/linux/torch/torch.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
33

44
#include "bsp/torch/torch.hpp"
5+
#include <log/log.hpp>
56

67
static xQueueHandle qHandleIrq = NULL;
78

module-bsp/board/rt1051/bellpx/bsp/rotary_encoder/rotary_encoder.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <timers.h>
88
#include <fsl_common.h>
99
#include <fsl_qtmr.h>
10+
#include <log/log.hpp>
1011

1112
/* Hardware PINS
1213
* TMR3_CH0-----GPIO_B0_06-----

module-bsp/board/rt1051/bellpx/hal/battery_charger/BatteryCharger.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <devices/power/MP2639B.hpp>
1414
#include <devices/power/CW2015.hpp>
1515
#include <board/BoardDefinitions.hpp>
16+
#include <log/log.hpp>
1617

1718
namespace
1819
{

module-bsp/board/rt1051/bsp/audio/CodecMAX98090.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#include "drivers/i2c/DriverI2C.hpp"
99
#include <cstdint>
1010

11-
#include <cstdint>
12-
1311
class CodecParamsMAX98090 : public CodecParams
1412
{
1513
public:

module-bsp/board/rt1051/bsp/eink/ED028TC1.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
#include "FreeRTOS.h"
1717
#include "task.h"
1818
#include "semphr.h"
19-
//#include "fat_media.h"
20-
//#include "vfs.h"
2119

22-
//#include "log.h"
20+
#include <log/log.hpp>
2321
#include "board.h"
2422
#include "eink_binarization_luts.h"
2523
#include "macros.h"

module-bsp/board/rt1051/bsp/headset/headset.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "fsl_common.h"
1010
#include "timers.h"
1111

12+
#include <log/log.hpp>
13+
1214
namespace bsp
1315
{
1416
namespace headset

module-bsp/board/rt1051/bsp/pit/pit.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#pragma once
55

66
#include <FreeRTOS.h>
7-
#include <FreeRTOS/include/queue.h>
7+
#include <queue.h>
88
#include <functional>
99

1010
namespace bsp

module-bsp/board/rt1051/bsp/rtc/rtc.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <module-os/RTOSWrapper/include/ticks.hpp>
1010
#include <time/time_constants.hpp>
1111
#include <time.h>
12+
#include <log/log.hpp>
1213

1314
namespace
1415
{

module-bsp/board/rt1051/bsp/torch/torch.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "drivers/i2c/DriverI2C.hpp"
99

1010
#include "fsl_common.h"
11+
#include <log/log.hpp>
1112

1213
using namespace drivers;
1314

module-bsp/board/rt1051/drivers/RT1051DriverDMAMux.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "RT1051DriverDMAMux.hpp"
55
#include <algorithm>
66

7+
#include <log/log.hpp>
8+
79
namespace drivers
810
{
911

module-bsp/board/rt1051/puretx/hal/battery_charger/BatteryCharger.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include <hal/battery_charger/AbstractBatteryCharger.hpp>
1717
#include <bsp/battery_charger/battery_charger.hpp>
18-
18+
#include <log/log.hpp>
1919
#include <magic_enum.hpp>
2020

2121
namespace

module-bsp/board/rt1051/puretx/hal/battery_charger/CurrentMeasurementScope.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33

44
#include "CurrentMeasurementScope.hpp"
55

6-
extern "C"
7-
{
86
#include "FreeRTOS.h"
9-
}
107
#include <timers.h>
118
#include <battery_charger/battery_charger.hpp>
9+
#include <log/log.hpp>
1210
#include <ticks.hpp>
1311

1412
#include <chrono>

module-bsp/board/rt1051/puretx/irq_gpio.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "board/rt1051/bsp/eink/bsp_eink.h"
1212
#include <hal/key_input/KeyInput.hpp>
1313
#include <hal/battery_charger/BatteryChargerIRQ.hpp>
14+
#include <log/log.hpp>
1415
#include "bsp/cellular/bsp_cellular.hpp"
1516
#include "bsp/headset/headset.hpp"
1617
#include "board/BoardDefinitions.hpp"

module-bsp/bsp/cellular/bsp_cellular.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <memory>
1010
#include <chrono>
1111
#include <FreeRTOS.h>
12-
#include <FreeRTOS/include/queue.h>
12+
#include <queue.h>
1313
#include "drivers/lpuart/DriverLPUART.hpp"
1414
#include <EventStore.hpp>
1515

module-bsp/devices/power/CW2015.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "FreeRTOS.h"
77
#include "task.h"
88

9+
#include <log/log.hpp>
10+
911
/// CW2015 tips&tricks
1012
/// 1. Setting POR bits in Mode register doesn't seem to reset the state of registers. Nevertheless it is required to
1113
/// perform proper profile update.

module-os/CMakeLists.txt

+31-48
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,30 @@
11
project(module-os VERSION 1.0
22
DESCRIPTION "OS module library")
33

4-
set(SOURCES
5-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/ccondition_variable.cpp
6-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/cevent_groups.cpp
7-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/cmem_pool.cpp
8-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/cmutex.cpp
9-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/cqueue.cpp
10-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/cread_write_lock.cpp
11-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/csemaphore.cpp
12-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/ctasklet.cpp
13-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/cthread.cpp
14-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/ctickhook.cpp
15-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/ctimer.cpp
16-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/cworkqueue.cpp
17-
18-
${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS/application.c
19-
${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS/event_groups.c
20-
${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS/heap_4.c
21-
${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS/list.c
22-
${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS/queue.c
23-
${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS/stream_buffer.c
24-
${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS/timers.c
25-
26-
${CMAKE_CURRENT_SOURCE_DIR}/memory/usermem.c
27-
28-
${CMAKE_CURRENT_SOURCE_DIR}/CriticalSectionGuard.cpp
29-
${CMAKE_CURRENT_SOURCE_DIR}/LockGuard.cpp
4+
add_library(${PROJECT_NAME} STATIC
5+
6+
RTOSWrapper/ccondition_variable.cpp
7+
RTOSWrapper/cevent_groups.cpp
8+
RTOSWrapper/cmem_pool.cpp
9+
RTOSWrapper/cmutex.cpp
10+
RTOSWrapper/cqueue.cpp
11+
RTOSWrapper/cread_write_lock.cpp
12+
RTOSWrapper/csemaphore.cpp
13+
RTOSWrapper/ctasklet.cpp
14+
RTOSWrapper/cthread.cpp
15+
RTOSWrapper/ctickhook.cpp
16+
RTOSWrapper/ctimer.cpp
17+
RTOSWrapper/cworkqueue.cpp
18+
19+
application.c
20+
memory/usermem.c
21+
22+
CriticalSectionGuard.cpp
23+
LockGuard.cpp
24+
25+
$<$<BOOL:${PROF_ON}>:prof/prof.c>
3026
)
3127

32-
add_library(${PROJECT_NAME} STATIC)
33-
target_sources(module-os PRIVATE ${SOURCES})
34-
if(NOT ${SYSTEM_VIEW_ENABLED})
35-
target_sources(module-os PRIVATE FreeRTOS/tasks.c)
36-
endif()
37-
if(${PROF_ON})
38-
target_sources(module-os PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS/prof.c)
39-
endif()
40-
4128
add_board_subdirectory(board)
4229

4330
# Board specific compilation definitions,options,include directories and features
@@ -50,15 +37,15 @@ target_compile_definitions(${PROJECT_NAME}
5037
PUBLIC
5138

5239
CPP_FREERTOS_CONDITION_VARIABLES
53-
)
40+
)
5441

5542
# enforce no optimization for RelWithDebInfo configuration to debug system memory
5643
if (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
57-
target_compile_options (${PROJECT_NAME} PRIVATE "-O0")
44+
set_source_files_properties(memory/usermem.c PROPERTIES COMPILE_OPTIONS "-O0")
5845
endif ()
5946

6047
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
61-
target_compile_definitions(${PROJECT_NAME} PRIVATE DEBUG_FREERTOS)
48+
target_compile_definitions(${PROJECT_NAME} PUBLIC DEBUG_FREERTOS)
6249
endif ()
6350

6451
target_include_directories(${PROJECT_NAME}
@@ -67,23 +54,19 @@ target_include_directories(${PROJECT_NAME}
6754

6855
${CMAKE_CURRENT_SOURCE_DIR}
6956

70-
${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS/include
71-
${CMAKE_CURRENT_SOURCE_DIR}/FreeRTOS
72-
${CMAKE_CURRENT_SOURCE_DIR}/RTOSWrapper/include
57+
RTOSWrapper/include
58+
prof
7359

7460
)
7561

7662
#Add FreeRTOS SystemvView headers if enabled
77-
if((${PROJECT_TARGET} STREQUAL "TARGET_RT1051") AND (${SYSTEM_VIEW_ENABLED}))
78-
target_include_directories(${PROJECT_NAME}
79-
PUBLIC
80-
${CMAKE_CURRENT_SOURCE_DIR}/systemviewPatch
81-
)
63+
if ((${PROJECT_TARGET} STREQUAL "TARGET_RT1051") AND (${SYSTEM_VIEW_ENABLED}))
8264
target_link_libraries(${PROJECT_NAME} PUBLIC segger::systemview)
83-
endif()
65+
endif ()
8466

85-
target_link_libraries(${PROJECT_NAME} PUBLIC log-api board-config)
67+
target_link_libraries(${PROJECT_NAME} PUBLIC log-api board-config freertos_kernel)
8668

8769
if (${ENABLE_TESTS})
8870
add_subdirectory(test)
8971
endif ()
72+

0 commit comments

Comments
 (0)