Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/build-test-baremetal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
DOCKER_IMAGE: kubasejdak/arm-none-eabi-gcc:13-24.04
- PRESET: freertos-armv7-m4-conan-gcc-release
DOCKER_IMAGE: kubasejdak/arm-none-eabi-gcc:13-24.04
- PRESET: freertos-armv7-m4-conan-clang-debug
DOCKER_IMAGE: kubasejdak/arm-none-eabi-clang:18-24.04
- PRESET: freertos-armv7-m4-conan-clang-release
DOCKER_IMAGE: kubasejdak/arm-none-eabi-clang:18-24.04
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -55,4 +59,4 @@ jobs:
# - examples-stm32f4
steps:
- name: Check all jobs
run: echo '${{ toJSON(needs.*.result) }}' | grep -qvE '"(failure|cancelled|skipped)"'
run: '! echo ''${{ toJSON(needs.*.result) }}'' | grep -qE ''"(failure|cancelled|skipped)"'''
2 changes: 1 addition & 1 deletion .github/workflows/build-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ jobs:
- sanitizers-x64
steps:
- name: Check all jobs
run: echo '${{ toJSON(needs.*.result) }}' | grep -qvE '"(failure|cancelled|skipped)"'
run: '! echo ''${{ toJSON(needs.*.result) }}'' | grep -qE ''"(failure|cancelled|skipped)"'''
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ jobs:
- generate-coverage-report
steps:
- name: Check all jobs
run: echo '${{ toJSON(needs.*.result) }}' | grep -qvE '"(failure|cancelled|skipped)"'
run: '! echo ''${{ toJSON(needs.*.result) }}'' | grep -qE ''"(failure|cancelled|skipped)"'''
4 changes: 3 additions & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
include:
- PRESET: linux-native-conan-clang-debug
DOCKER_IMAGE: kubasejdak/clang:18-24.04
- PRESET: freertos-armv7-m4-conan-clang-debug
DOCKER_IMAGE: kubasejdak/arm-none-eabi-clang:18-24.04
steps:
- uses: actions/checkout@v6

Expand All @@ -47,4 +49,4 @@ jobs:
- linting
steps:
- name: Check all jobs
run: echo '${{ toJSON(needs.*.result) }}' | grep -qvE '"(failure|cancelled|skipped)"'
run: '! echo ''${{ toJSON(needs.*.result) }}'' | grep -qE ''"(failure|cancelled|skipped)"'''
8 changes: 8 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@
{
"name": "freertos-armv7-m4-conan-gcc-release",
"inherits": ["freertos-armv7-m4-gcc", "release", "conan"]
},
{
"name": "freertos-armv7-m4-conan-clang-debug",
"inherits": ["freertos-armv7-m4-clang", "debug", "conan"]
},
{
"name": "freertos-armv7-m4-conan-clang-release",
"inherits": ["freertos-armv7-m4-clang", "release", "conan"]
}
]
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Kuba Sejdak (<kuba.sejdak@gmail.com>)
Copyright (c) 2019 Kuba Sejdak (kuba.sejdak@gmail.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/Findplatform.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include(FetchContent)
FetchContent_Declare(platform
GIT_REPOSITORY https://github.com/kubasejdak-org/platform.git
GIT_TAG db273b749620432ea33300cce10d2431fb1db1d4
GIT_TAG f7e9d72017452973400fa02a442b6fc3335aebc3
SOURCE_SUBDIR lib
)

Expand Down
8 changes: 8 additions & 0 deletions cmake/presets/baremetal.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
"cacheVariables": {
"TOOLCHAIN": "arm-none-eabi-gcc"
}
},
{
"name": "freertos-armv7-m4-clang",
"hidden": true,
"inherits": "freertos-armv7-m4",
"cacheVariables": {
"TOOLCHAIN": "arm-none-eabi-clang"
}
}
]
}
6 changes: 6 additions & 0 deletions lib/osal/freertos/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
InheritParentConfig: true
Checks: '
-misc-include-cleaner
'
...
1 change: 1 addition & 0 deletions lib/osal/freertos/Mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>

#include <cstdint>
#include <cstring>

OsalError osalMutexCreate(OsalMutex* mutex, OsalMutexType type)
Expand Down
1 change: 1 addition & 0 deletions lib/osal/freertos/Semaphore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>

#include <cstdint>
#include <cstring>
#include <limits>

Expand Down
11 changes: 8 additions & 3 deletions lib/osal/freertos/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,24 @@
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>

#include <bit>
#include <cstdint>
#include <cstring>

namespace {

/// Helper thread function which is used as a wrapper for OSAL thread function.
/// @param arg Helper thread arguments.
/// @note This function is used to implement thread joining.
static void threadWrapper(void* arg)
void threadWrapper(void* arg)
{
auto* params = static_cast<ThreadWrapperData*>(arg);
params->func(params->arg);
osalSemaphoreSignal(&params->semaphore);
}

} // namespace

OsalError osalThreadCreate(OsalThread* thread, OsalThreadConfig config, OsalThreadFunction func, void* arg)
{
return osalThreadCreateEx(thread, config, func, arg, nullptr);
Expand Down Expand Up @@ -132,7 +137,7 @@ OsalError osalThreadJoin(OsalThread* thread)
return OsalError::InvalidArgument;

auto error = osalSemaphoreWait(&thread->impl.params.semaphore);
if (error)
if (error != OsalError{})
return error;

thread->joined = true;
Expand All @@ -146,7 +151,7 @@ void osalThreadYield()

uint32_t osalThreadId()
{
return static_cast<std::uint32_t>(reinterpret_cast<std::uintptr_t>(xTaskGetCurrentTaskHandle()));
return static_cast<std::uint32_t>(std::bit_cast<std::uintptr_t>(xTaskGetCurrentTaskHandle()));
}

OsalError osalThreadName(char* name, size_t size)
Expand Down
2 changes: 2 additions & 0 deletions lib/osal/freertos/sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>

#include <cstdint>

void osalSleepMs(uint64_t cDurationMs)
{
vTaskDelay(cDurationMs / portTICK_PERIOD_MS);
Expand Down
6 changes: 3 additions & 3 deletions lib/osal/include/osal/Semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extern "C" {
#include "internal/SemaphoreImpl.h"
#include "osal/Error.h"

#include <stdint.h> // NOLINT(modernize-deprecated-headers,hicpp-deprecated-headers)
#include <stdint.h>

/// Represents OSAL semaphore handle.
/// @note Size of this structure depends on the concrete implementation. In particular, SemaphoreImpl
Expand All @@ -47,9 +47,9 @@ struct OsalSemaphore {

/// Creates new semaphore with the given initial value.
/// @param semaphore Semaphore handle to be initialized.
/// @param initialValue Initial value of the semaphore to be created.
/// @param initValue Initial value of the semaphore to be created.
/// @return Error code of the operation.
OsalError osalSemaphoreCreate(OsalSemaphore* semaphore, unsigned int initialValue);
OsalError osalSemaphoreCreate(OsalSemaphore* semaphore, unsigned int initValue);

/// Destroys semaphore represented by the given handle.
/// @param semaphore Semaphore handle to be destroyed.
Expand Down
4 changes: 2 additions & 2 deletions lib/osal/include/osal/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ extern "C" {
#include "internal/ThreadImpl.h"
#include "osal/Error.h"

#include <stddef.h> // NOLINT(modernize-deprecated-headers,hicpp-deprecated-headers)
#include <stdint.h> // NOLINT(modernize-deprecated-headers,hicpp-deprecated-headers)
#include <stddef.h>
#include <stdint.h>

/// Represents OSAL thread handle.
/// @note Size of this structure depends on the concrete implementation. In particular, ThreadImpl
Expand Down
2 changes: 1 addition & 1 deletion lib/osal/include/osal/sleep.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif

#include <stdint.h> // NOLINT(modernize-deprecated-headers,hicpp-deprecated-headers)
#include <stdint.h>

/// Suspends the current thread for the specified amount of time in ms.
/// @param cDurationMs Amount of time in ms for which current thread should be suspended.
Expand Down
6 changes: 3 additions & 3 deletions lib/osal/include/osal/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ extern "C" {

#include "osal/Error.h"

#include <stddef.h> // NOLINT(modernize-deprecated-headers,hicpp-deprecated-headers)
#include <sys/time.h> // NOLINT(modernize-deprecated-headers,hicpp-deprecated-headers)
#include <time.h> // NOLINT(modernize-deprecated-headers,hicpp-deprecated-headers)
#include <stddef.h>
#include <sys/time.h>
#include <time.h>

/// Converts time_t value to struct tm.
/// @param value Value to be converted.
Expand Down
2 changes: 1 addition & 1 deletion lib/osal/include/osal/timestamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
extern "C" {
#endif

#include <stdint.h> // NOLINT(modernize-deprecated-headers,hicpp-deprecated-headers)
#include <stdint.h>

/// Returns the timestamp relative to library initialization in ms.
/// @return Timestamp relative to library initialization in ms.
Expand Down
4 changes: 2 additions & 2 deletions lib/osal/linux/Semaphore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
#include <cstring>
#include <ctime>

OsalError osalSemaphoreCreate(OsalSemaphore* semaphore, unsigned int initialValue)
OsalError osalSemaphoreCreate(OsalSemaphore* semaphore, unsigned int initValue)
{
if (semaphore == nullptr)
return OsalError::InvalidArgument;

sem_t handle{};
[[maybe_unused]] auto result = sem_init(&handle, 0, initialValue);
[[maybe_unused]] auto result = sem_init(&handle, 0, initValue);
assert(result == 0);

semaphore->impl.handle = handle;
Expand Down
4 changes: 2 additions & 2 deletions tests/init/freertos-arm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ target_sources(platform-init PRIVATE
find_package(stm32f4xx)

target_include_directories(stm32f4xx
PUBLIC
SYSTEM PUBLIC
.
)

Expand All @@ -23,7 +23,7 @@ target_link_options(platform-init
add_library(freertos-config INTERFACE)

target_include_directories(freertos-config
INTERFACE
SYSTEM INTERFACE
.
)

Expand Down
Loading