leka / lekaos Goto Github PK
View Code? Open in Web Editor NEWLekaOS is Leka's firmware based on Mbed OS
Home Page: https://leka.io
License: Apache License 2.0
LekaOS is Leka's firmware based on Mbed OS
Home Page: https://leka.io
License: Apache License 2.0
The BlueNRG configuration is by using the raw pin names. Change it to use the LekaPinNames.h values.
Related epic/story: #6
This story's goal is to track the documentation process.
General documentation should be in the Wiki and specific documentation should be in README.md
where they belong.
If in double, discussion can happen here.
This list will be updated in the future
LekaOS is divided between the main application and the bootloader.
Both of them should be present under src
.
Related epic/story: #7
When editing a readme, it's not useful to run all the CI workflows.
Related epic/story: #7
FastLED has been included in our project to work with our MCU.
But the FastLED code is bloated, complicated and has a lot of dependencies we don't actually use.
Rework the library to make it more user friendly.
Related epic/story: #30
wait_ns
and compare usage to mbed trace https://github.com/armmbed/mbed-trace
Add an Hello World library example to make sure compilation works correctly.
The wiki is nice but not that easy to maintain and edit. Move back the documentation to the main repository.
Related epic/story: #25
Add documentation about the directory structure and its purposes.
Related epic/story: #7
It's important do precisely study and understand how mbed works, the different API, drivers & communication stacks.
This issue of type: epic
will be used to gather information, share what we have learned and things that could be useful in the future.
Add clang format check to CI to make sure files are properly formatted before merging.
https://github.com/DoozyX/clang-format-lint-action
Related epic/story: #7
related to #7
Clean up the targets repository.
Related epic/story: #26
Main topics:
Create a document to gather all specifications of the behavior of the robot. Each component of it must be tested at its maximum in order to have the worst situation for investigation day. Values has to be clear.
Related epic/story: #36
Develop a simple script to make sure that the design doc containing all the pins and their functions is correctly implemented in STM32CubeMX.
Related epic/story: #26
A lot of headers and source files are including mbed.h.
A lot of them don't really need mbed.h but only PinNames.h for example.
Check all source files and decide if it's really needed.
Related epic/story: n/a
Before implementing a new functionality into the main firmware, it's usually good practice to make a small test application demonstrating the use case, how it works and open discussion to implementation before opening a PR.
This story gathers all the test apps and related discussion.
This main post will be updated with new test apps to include.
Related epic/story: n/a
A deeper understanding of the bootloader and linker script inner functioning is needed to work firmware update OTA.
Here are some interesting resources:
macOS costs too many minutes of free github action time... Move to linux!
Related epic/story: #7
Follow the rules in:
Related epic/story/task: #78
The LEKA_V1.0_DEV target is based on the DISCO_F769 with minor configuration.
As the mainboard evolve, continue to customise the LEKA_V1.0_DEV target to suit our need.
Related epic/story: #26
Documentation related to QSPI Flash, OpenOCD & Linker configuration.
The goal is to have OpenOCD flash both the main mcu and the factory QSPI flash during manufacturing.
For development and later for production phases, we need to implement custom targets to make the process easier
Related epic/story: #26
related to #7
Separate drivers (directly talking to hardware) from libs (higher level functions)
Related epic/story: #7
lib
to libs
drivers
directoryBLE communication with the iPad is one of the most important feature of LekaOS. Without it the robot is useless and its presence allow us to:
This first step is really easy: use the examples from mbed-os to create a simple working example of BLE for Leka to pave the way for future developments
This must include:
Through out our development we will need to start tasks and stop them. Gaining a deeper understanding about how this will work between BLE and mbed os is paramount as all future development will rely on that.
More information in #1 - #1 (comment)
This must include:
We'll review, update and implement the Leka Communication Specifications in parallel with the iOS app.
The main goal is to have the two perfectly synchronised.
This must include:
Display a JPEG image on the screen connected on Leka board.
Journée d’investigation:
components_add
in custom_target.json filefopen
from FILE) ❌f_open
from FIL) ✅decode_dma
jpeg_utils
jpeg_utils_conf
BSP_DISCO_F769NI
JPEG_Decode_DMA
✅
JPEG_Decode_DMA
(decode_dma
)HAL_JPEG_Decode_DMA
(stm32f7xx_hal_jpeg
)JPEG_DMA_StartProcess
(stm32f7xx_hal_jpeg
)hjpeg->hdmain->XferCpltCallback = JPEG_DMAInCpltCallback;
hjpeg
mal instanciéHAL_JPEG_MspInit
(stm32f7xx_hal_jpeg
) vide et en __weakJPEG_Decode_DMA
JPEG_Decode_DMA
(decode_dma
)HAL_JPEG_Decode_DMA
(stm32f7xx_hal_jpeg
)JPEG_DMA_StartProcess
(stm32f7xx_hal_jpeg
)JPEG_ENABLE_DMA(hjpeg, JPEG_DMA_IDMA | JPEG_DMA_ODMA);
MODIFY_REG(hjpeg->Instance->CR, ((JPEG_DMA_IDMA | JPEG_DMA_ODMA) & JPEG_DMA_MASK), 1UL);
JPEG_InputHandler
(decode_dma
)Jpeg_IN_BufferTab
always FULLJPEG_OutputHandler
never FULLLCDReset
→ Hardware reset de ...MSPInit
→ HAL Initialize modules in MCU related to display processDSIInit
→ "Driver" Initialize DSI interfaceLTDCInit
→ "Driver" Initialize LTDC with SDRAM (?)SDRAMInit
(inLTDCInit
) → HAL and "Driver" Initialize of SDRAMOTM8009AInit
→ Driver Initialize LCDLTDCLayerInit
→ Configuration couche écransetActiveLayer
→ Désigner la couche active (2)clear
→ Nettoyer l’écran avec une couleurdrawRectangle
fillBuffer
→ Transfert du dessin dans DMA2DDSI_IO_WriteCmd
(otm8009a
) vide et en __weakhdma
OTM8009A_MADCTR_MODE_LANDSCAPE
dans otm8009a
)OTM8009A_Init
dans son driver, nécessite de bien définir DSI_IO_WriteCmd
related to #7
LekaOS is a great project and a big project that will grow in size considerably over the next few months. It's important for the sanity of all the developers involved that good defaults and standards are setup and chosen at the beginning to reduce friction and bikeshedding.
Different topics will be covered:
LekaOS will follow the monorepo philosophy, which means that all the dependencies will be located inside this repository. No external dependencies, no submodules, everything must compile after git clone
.
Root folders will be:
.azure-ci
or .github
- CI related tasksdocs
- documentationlib
- library foldersrc
- sources of the main applicationtest
- tests --> unit
, functional
, integration
script
- scripts used by different processesCoding style is taken care of by EditorConfig and ClangFormat.
LekaOS will be compiled using GCC ARM None Eabi.
Some tests must be run to see wether we use mbed-cli, Make of CMake.
LekaOS needs to store and access a lot of information/content while working.
For example:
Estimation on the size required to stock all this content must be done.
This epic will discuss how we should organize the inner working of LekaOS.
This story gathers all the information and ideas about the firmware update process: strategy, support, security, tests, etc.
Related epic/story: n/a
.hex
or .bin
?The question asked is should we send the update as a .bin
file or .hex
.
The question was asked to the community here:
ARM Mbed OS Forum - Firmware Update w/ FlashIAP - .bin or .hex?
The answers provide useful information:
.bin
is smaller than .hex
.hex
incorporate a checksum for each lines.bin
allows for custom binary framing to provide additional information.bin
allows for custom frame length to send more information each timeWith those information, the .bin
approach seems to be better in many points.
Following the ".hex
or .bin
?" question, we must investigate and decide if we want to use SD Memory Card or QSPI Flash.
Pros of the SD Card:
.bin
Cons of the SD Card:
Pros of the QSPI Flash:
Cons of QSPI Flash:
With those information, QSPI Flash seems to be a good candidate for simple systems with low resources and low memory available.
On the other hand, the SD Card approach gives us a higher level view of the subject and allow us to use concepts closer to those of a regular computer. The SD Card can also be flashed before and more testing can be done.
In conclusion:
For firmware update through untrusted channels (BLE, Wifi, etc.), security is paramount! We can distinguish two types of security:
Signing means that the content of the file is signed, a hash is generated and it can be checked to make sure it comes from Leka and not from someone else. With just signing, the content of the firmware update is visible to the external world.
Encrypting means that from the original content we generate a cyphered version of the update that has to be decrypted once on the device. If someone steals the update, they won't be able to read it's content.
Both signing and encrypting must be done on the firmware sent for the update.
Useful links:
The .bin
approach lets us use a custom binary frame for the data we send.
Source: Specs-FOTA-Frame.gsheet
Item | Size | Type | Content | Comment |
---|---|---|---|---|
Start bytes | 4 bytes | array[4] {uint8_t} |
[2A 2B 2C 2D] |
Start sequence to recognize a frame |
Header | ||||
Size | 1 byte | uint8_t |
The size of the data contained in the current frame (1..256 ) |
|
Data type | 1 byte | uint8_t |
- 00 - Firmware version- 01 - Firmware size- 02 - Number of frames to receive- 03 - Global CRC |
The type of data received |
CRC | 1 byte | uint8_t |
CRC Checksum of the current frame's data ( |
|
Data | The data contained in the current frame. It can only be of one type | |||
Firmware version | 3 bytes | array[3] {uint8_t} |
major minor patch |
|
Firmware size | 4 bytes | uint32_t |
Total size of the firmware to be sent | |
Number of frames to receive | 4 bytes | uint32_t |
Number of frames to be sent for the update | |
Global CRC | 4 bytes | uint32_t |
CRC Checksum of the firmware | |
Stop bytes | 4 bytes | array[4] {uint8_t} |
[2D 2C 2B 2A] |
Stop sequence at the end of a frame |
Hello, I'm the bootloader!
I'm waiting for 5 seconds before starting the application...
1... 2... 3... 4... 5...
Starting application now!
Hello, I'm application!
I'm running in a loop.
1
2
3
// [...]
Hello, I'm the bootloader!
I'm waiting for an application to be sent to me...
1... 2... 3... 4... 5... // [...]
An application is available! I'm writing the application to MCU Flash!
// [...]
Application written to MCU Flash!
Starting the application now!
Hello, I'm application!
I'm running in a loop.
1
2
3
// [...]
Hello, I'm the bootloader!
I'm waiting for an application to be sent to me...
1... 2... 3... 4... 5...
An application is available! I'm writing the application to QSPI flash!
// [...]
Application written to QSPI!
I'm writing the application to MCU Flash!
// [...]
Application written to MCU Flash!
Starting the application now!
Hello, I'm application!
I'm running in a loop.
1
2
3
// [...]
Hello, I'm the bootloader!
Checking if a new application is available...
No application available.
Starting current application now!
Hello, I'm application!
I'm running in a loop waiting for an new application to be sent to me...
1
2
3
// [...]
An application is available! I'm writing the application to QSPI flash!
Application written to QSPI!
Rebooting...
Hello, I'm the bootloader!
Checking if a new application is available...
New application available!
Now I'm written the application to the MCU...
Application written to MCU.
Starting new application now!
to do
The current version of the watchdog uses a thread.
@YannLocatelli proposed an alternative solution using a ticker which might be more light weight here: #17 (comment)
#include "mbed.h"
Ticker kicker;
void watchdogKick()
{
Watchdog::get_instance().kick();
}
int main()
{
printf("\n\nDemonstration of watchdog in case of error (happens in 10s).\n");
const uint32_t TIMEOUT_MS = 5000;
Watchdog &watchdog = Watchdog::get_instance();
watchdog.start(TIMEOUT_MS);
kicker.attach_us(watchdogKick, 1000);
ThisThread::sleep_for(10s);
error("This is a reason why watchdog exists. Restarting in 5000ms...\n");
return 0;
}
Related epic/story: #19
related to #7
Leka is based on the DISCO_F769NI target.
A custom target must be created. This includes:
From Pierre:
Currently mbed-os is located inside the lib/_vendor directory.
Even with the _vendor
directory, it's not that clear that this library is not supposed to be modified.
We should move it to the extern
or external
repository at the root of the project.
Related epic/story: #7
This story gathers all the tasks related to:
Related epic/story: n/a
Répartition des composants pour la journée d’investigation
Autres:
The goal of this story is
Related epic/story:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.