Skip to content

v0.4.0

Choose a tag to compare

@FreddieChopin FreddieChopin released this 11 Mar 12:19
· 2545 commits to master since this release

Added

  • Support for all 78 STM32F7 chips.
  • Support and test configuration for 32F746GDISCOVERY board with STM32F7 chip.
  • Set STKALIGN bit in SCB->CCR for ARM Cortex-M3 r1p1 (like STM32F1). Thanks to that, stack will be automatically aligned to 8-bytes on exception entry, which is required by AAPCS. This bit is set by default on all other ARM Cortex-M cores.
  • FATAL_ERROR() macro with weak fatalErrorHook().
  • "Check context of functions" option in Kconfig menus. When this option is selected, the context of functions which must not be used from interrupt context (all blocking functions, all Mutex functions and all functions from ThisThread namespace) is checked during run-time. If a violation is detected, FATAL_ERROR() is called with appropriate message. See help of the new option for more info.
  • "Check stack pointer range during context switch" option in Kconfig menus. Selecting this option enables simple range checking of preempted thread's stack pointer during context switches. Such check is relatively fast, but cannot detect all stack overflows. FATAL_ERROR() is called with appropriate message when an overflow is detected. Check new option's help for more info.
  • "Check stack guard contents during context switch" option in Kconfig menus. When enabled, this option extends stacks for all threads (including main() thread) with a "stack guard" at the overflow end. This "stack guard" - just as the whole stack - is filled with a sentinel value during thread initialization. During each context switch contents of preempted thread's "stack guard" are checked - if any byte has changed, FATAL_ERROR() will be called with appropriate message. This method is able to detect stack overflows much more reliably than simple stack pointer range checking and is still sufficiently fast, assuming that the size of "stack guard" is reasonable. For more info, check new option's help.
  • "Check stack pointer range during system tick" and "Check stack guard contents during system tick" options in Kconfig menus, which are similar to "Check stack pointer range during context switch" and "Check stack guard contents during context switch" respectively, but executed during every system tick.
  • Thread::getStackSize() and ThisThread::getStackSize() which can be used to get thread's stack size.
  • Thread::getStackHighWaterMark() and ThisThread::getStackHighWaterMark() which can be used to get "high water mark" (max usage) of thread's stack.
  • Test of thread's start() returning ENOSPC when stack is too small.
  • STM32-bit-banding.h header with STM32_BITBAND_ADDRESS() and STM32_BITBAND() macros, which are more suited for STM32's CMSIS headers - it's enough to write STM32_BITBAND(RCC, CR, PLLON) instead of BITBAND(&RCC->CR, RCC_CR_PLLON_bit). Note that these new macros must not be used with FLASH registers - use STM32_BITBAND_FLASH() and STM32_BITBAND_FLASH_ADDRESS() for that peripheral.
  • Options to enable STM32's GPIO to Kconfig menu.
  • New chips: 10 STM32F413 chips and 5 STM32F423 chips.
  • README.md files for all supported boards.

Changed

  • Changed placement of fixed stacks for ARMv6-M and ARMv7-M in generated linker script. Stack for interrupts ("main" stack) is located at the beginning of RAM, so any stack overflow during interrupt handling will cause a HardFault exception. Stack for main() thread ("process" stack) is placed at the end or RAM, after heap, which introduces a potential safety margin for any stack overflows in this thread - as long as heap's last block is not allocated, the memory below this stack is not used.
  • Stacks are filled with 0xed419f25 instead of 0. Using 0 is not a reliable method to detect stack usage/overflow, as 0 is very likely to be used in the application (for example to zero-initialize variables).
  • Reduced default size of stack for interrupts to 1kB.
  • Reduced size of stack for interrupts to 1kB in all test configurations.
  • Reduced size of stack for idle thread to 256 bytes when support for thread detachment is enabled.
  • architecture::requestFunctionExecution() checks for amount of free stack before doing any stack modifications. If there's not enough free stack available, it returns an ENOSPC error code. Modify all callers of this function (which includes functions to generate/queue signals and set signal mask) to handle this error code.
  • Changed number of threads, software timers, queued signals and signal actions used by test application to 8 (was 10) to reduce its RAM requirements. This fixes a crash of test application for NUCLEO-F103RB board caused by insufficient memory available for _sbrk_r() and crashes of other configurations at lower optimization levels due to stack overflow.
  • Reimplemented callOnce() with a mutex. This increases the size of OnceFlag object (32 bytes vs 8 bytes), but at the same time reduces stack requirements of any thread using callOnce() function. Removed ThreadState::blockedOnOnceFlag enum value.
  • Cleaned up architecture namespace, leaving only architecture-specific elements. Moved Stack, InterruptMaskingUnmaskingLock and InterruptUnmaskingLock to internal namespace. Moved InterruptMaskingLock to distortos namespace.
  • Removed virtual Thread::start() and convert overrides available via DynamicThread and StaticThread to non-virtual functions.
  • architecture::initializeStack() checks for buffer overflow before actually doing any memory operations. If stack is too small for stack frame, ENOSPC error code is returned. Modify all call paths - starting at DynamicThread::start() and StaticThread::start() - to handle this error.
  • Moved lowLevelInitialization0() to the very beginning of reset handler.
  • Renamed BITBAND_PERIPH() macro to BITBAND_PERIPHERAL().
  • Moved remaining ARMv6-M and ARMv7-M assembly functions (Reset_Handler() and SVC_Handler) to C++ source files.
  • ARMv6-M-ARMv7-M-Reset_Handler.cpp no longer requires __USES_CXX and __USES_TWO_STACKS to be defined in compilation flags.
  • Moved enabling of RCC clocks for STM32's GPIO from board::lowLevelInitialization() to chip::lowLevelInitialization().
  • Buttons and LEDs for boards depend on enabling the GPIO port to which they are connected. "Enable buttons" and "Enable LEDs" options in Kconfig menu are available only if at least one GPIO port of buttons / LEDs is enabled. Preprocessor macros with total number of buttons and LEDs which were previously provided by Kconfig - CONFIG_BOARD_TOTAL_BUTTONS and CONFIG_BOARD_TOTAL_LEDS - were renamed to DISTORTOS_BOARD_TOTAL_BUTTONS and DISTORTOS_BOARD_TOTAL_LEDS. These macros are now generated automatically by buttons.hpp and leds.hpp respectively.
  • Update CMSIS-STM32F0 to version 1.7.0.
  • Update CMSIS-STM32F4 to version 1.14.0.

Fixed

  • Added ChipSpiMasterLowLevel and ChipUartLowLevel classes to "devices" group in API reference generated by doxygen.
  • Compiler's built-in defines are passed automatically to doxygen, which fixes some missing documentation entries (for example bit-banding macros).
  • Fixed failures in several test cases (ThreadSleepForTestCase, SignalsInterruptionTestCase and CallOnceOperationsTestCase) that occured only with low core frequency due to very strict timing requirements.
  • Fixed stack overflow in CallOnceOperationsTestCase which occured only on ARM Cortex-M0 cores with -Og optimization level.
  • Maximum values of APB1 and APB2 frequencies for STM32F4 take into account whether over-drive is enabled or not.

Removed

  • lowLevelInitialization1() - which was executed right before calling main() - from reset handler.
  • All ...-bits.h headers files, which are superseded by recent versions of CMSIS headers.
  • Configuration of chip package from Kconfig menu.