Giter VIP home page Giter VIP logo

wav-rtos-sw's Introduction

Wavious RTOS SW

Wavious RTOS Base Software project. This project contains all code that runs on the various wavious cores utilizing FreeRTOS

pre-commit

This project uses pre-commit to ensure that all source files are properly formatted. To install pre-commit, ensure that you have a version of python installed as well as pip. With pip installed run: pip install pre-commit

Once pre-commit is installed via python3, then pre-commit needs to be installed for this project. Run the following to install pre-commit: pre-commit install -c wav-build/.pre-commit-config.yaml

pre-commit will be executed any time git commit command is executed.

Refer to pre-commit for more details.

Build Configuration

When the project is first clone, the project needs to be configured using the following command:

./configure --board <bsp-board>

where bsp-board is the targeted supported wavious core.

Since Wavious RTOS Base Software project is meant to be used as a submodule for other Wavious projects, the configure script has been designed such that it can be sourced and expanded for other projects. Arguments specific to wav-rtos-sw configuration script are passed when invoking the parent's configure script. Additionally, "extra" cmake arguments can be passed directly to this projects configure script so that the cmake project is fully configured.

An example from Wavious LPDDR SW project:

  # Invoke RTOS configure script with addtional parameters
  args=(
      -DCONFIG_TARGET_PHY=${CONFIG_TARGET_PHY}
      -DCONFIG_CALIBRATE_PLL=${CONFIG_CAL_PLL}
      -DCONFIG_CALIBRATE_ZQCAL=${CONFIG_CAL_ZQCAL}
      -DCONFIG_CALIBRATE_SA=${CONFIG_CAL_SA}
      -DCONFIG_DRAM_TRAIN=${CONFIG_DRAM_TRAIN}
      -DCONFIG_CAL_PERIODIC=${CONFIG_CAL_PERIODIC}
  )
  source ${WAV_RTOS_DIR}/configure ${PARAMS} ${args[@]}

  To invoke: ./configure --board wavious-mcu

  board argument is passed to wav-rtos-sw configure script via ${PARAMS} argument

Building with CMAKE

Once the environment is configured, software can be built using the make command when in the build directory.

cd build
make

NOTE

It is recommended that you use Docker to build this project. A Docker container can be started by running the following command from the root of this project: ./docker/run.sh. It is important to run the configure command within the Docker container.


FSM vs StateMachine

FSM provides a dedicated task that all FSMs share. FSM events are submitted to a queue and processed directly by the FSM task, which move the FSM between diferrent states. This can be nice to have when the software has many FSMs that need to be used but doesn't need tight control of the run loop. It can save memory by having all events processed in a single place and dispatched to the appropriate FSM.

Some implementations, such as a firmware, need better performance and would like tight control of their event loop and context switching. StateMachine offers a non-threaded implementation that can be used for these cases.

Background

Originally, FSM was the only implementation and the need for StateMachine was realized later. For compatibility reasons, the FSM implementation was kept around and a unique non-threaded implementation was added.

wav-rtos-sw's People

Contributors

wavious-wpatty avatar wavious-jbasista avatar

Stargazers

Masanori Ogino avatar  avatar

wav-rtos-sw's Issues

Feature Request: Allow for configure script chaining

Feature

configure script is specific to wav-rtos-sw. However, other projects that use this project will likely have configure scripts as well that set additional cmake variables. Instead of replicating wav-rtos-sw configure script they should be able to safely source the configure script and then add any additional cmake variables after the fact.

Patch

diff --git a/configure b/configure
index 29e62f0..edb1732 100755
--- a/configure
+++ b/configure
@@ -2,7 +2,7 @@
 # Configures build environment for appropriate target architecture
 
 # Definitions
-RISCV_TOOLCHAIN="toolchain/riscv.toolchain"
+RISCV_TOOLCHAIN="${RISCV_TOOLCHAIN}/toolchain/riscv.toolchain"
 BUILD_DIR="build"
 
 # Variables
@@ -63,10 +63,6 @@ while [ $# -gt 0 ]; do
       shift
       break
       ;;
-    -*|--*=) # unsupported flags
-      echo "Error: Unsupported flag $1" >&2
-      exit 1
-      ;;
     *) # preserve positional arguments
       PARAMS="$PARAMS $1"
       shift

Issue: newlib_nano is used as default c standard library

Issue

This isn't an issue as much as it is a preference. It would be better to not specify a --specs in the linker / compile options of CMAKE. Instead, this option can be added at a top-level project by adding to the linker and compile options. Not specifying is a better default as it's easier to add the option, than it is to remove it.

Issue: Linker script is too coupled to HAL/OSAL

Issue

Currently, the linker script is too coupled to freedom metal and FreeRTOS pair. We need to design an infrastructure for selecting the linker script.

Furthermore, we need a way such that once it's selected, it's set for all targets that are built for that configuration. This was the intent of the current design but after integrating v1.3-rc.2 with wav-lpddr-sw, its clear that add_linker_option is only scoped within wav-rtos-sw and doesn't apply to targets built at wav-lpddr-sw level.

We will probably just ship v1.3 with this being coupled and try to tackle it for the next major release.

Feature Request: Allow for overriding FreeRTOSConfig.h params

Certain applications might want to configure some FreeRTOSConfig.h parameters depending on the needs of that application. For example, configUSE_IDLE_HOOK can be used to run specific code whenever the idle task is executed. On LPDDR, it would be nice to have the wfi instruction used during this case.

We should update the board level configs to wrap each define in an ifdef and/or allow a user specific FreeRTOSConfig.h to be used.

Issue: Remove newlib support from FreeRTOSConfig.h

Issue

newlib support should be removed from FreeRTOSConfig.h. It's enabled but not hooked up properly. Additionally, our projects shouldn't be using newlib functions that require reentrancy. Instead, safer implementations will be used (printf in wavious-wh440). Since the newlib support is enabled for FreeRTOS, it is bringing in unnecessary functions growing the size of the code.

If for some reason newlib support is required, then the flag can be reenabled through CMAKE compile options. But this shouldn't be needed.

Issue: ELF Dump Image Header Incorrect

Issue

A readable "dump" of the ELF file is created as a post build step for the sample application. This is done prior to patching the Image Header in the ELF with correct data and crc. This causes the "dump" to have incorrect header contents.

Fix

Fix would be to ensure that dump file isn't created until after the Image Header is patched. Also, it would be best to probably move the dump into the BSP CMakeLists.txt so that it's done for each application automatically.

Feature Request: FreeRTOSConfig.h Cleanup

Request

FreeRTOSConfig.h should be cleaned up for all BSPs. These configurations were generated for SiFive's FreeRTOS extension. This is no longer being used. The standard format should be used. It can be found here.

Issue: Notification_t size should be fixed

Issue

Currently Notification_t is an alias for UBaseType_t, which is dynamic based on the native word size of the processor. For 64-bit processors, the Notification_t type becomes too large to be used in some APIs (like Task Notifications).

Notification_t should just alias uint32_t instead.

Issue: vReceiveMessage mismatches return type

The 'v' in vReceiveMessage stands for the fact that the function returns void. However, vReceiveMessage actually returns BaseType_t. vReceiveMessage should be changed to xReceiveMessage.

Feature Request: Deprecate RISC-V 32 Toolchain file

Feature

RISC-V GNU Toolchain can be built with multilib option that allows riscv64-* binaries to build 32-bit application using -mabi flags. Docker images have been built that use the single binary approach.

RTOS toolchains directory should be consolidated to a single file for RISC-V so that it is compatible with the new Docker images.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.