Git Product home page Git Product logo

thecore-embedded / thecore Goto Github PK

View Code? Open in Web Editor NEW
79.0 18.0 23.0 23.52 MB

theCore: C++ embedded framework

Home Page: https://forgge.github.io/theCore

License: Mozilla Public License 2.0

CMake 13.54% Nix 0.35% C++ 82.21% C 1.06% Assembly 1.26% Shell 0.66% Python 0.92%
embedded embedded-systems stm32 tiva-c-series nix cmake superproject driver framework cortex-m4 cpp11 cpp14 cpp17 iot iot-framework iot-device iot-middleware python3 python

thecore's Introduction

theCore: C++ Embedded Framework

Build Status Join the chat at https://t.me/joinchat/HQF-SEgtMQXoNOq_D71pSg Follow us at https://t.me/theCoreEmbedded Join the chat at https://gitter.im/forGGe/theCore

theCore is the C++ embedded framework for various microcontroller applications, with or without RTOS (bare-metal).

theCore tries to provide all that is necessary to create portable application code:

  • Startup, initialization and periphery code for each supported platform.
  • Build system support for different platform and target configurations.
  • Platform-independent device drivers, like temperature sensors or displays.
  • Optional OS-related abstractions: semaphores, mutexes and threads.
  • Easy-to-deploy development environment.
  • Different libraries and utilities.

Documentation

theCore documentation hosted on GitHub pages and available in two formats: multi-page HTML for ease of navigation and single-page HTML for ease of manual searching.

Doxygen documentation is also available (trough it is not complete).

Where to get theCore

theCore is now available only from source and hosted solely on GitHub. There are different branches for development and stable versions. Check Branching section for information about branches purpose.

Getting started

You can start using theCore by completing guides and tutorials in the Guides section or check the source code of the standalone blinky example project.

It is also worth to look at examples that are placed in examples dir and read the Examples section to understand how to build and launch them.

Supported platforms

Supported platform list along with information about each platform is located in Platforms section.

Here a couple of additional references that you might be interest in:

License

The source code is distributed under MPL v2.0 License (Mozilla Public License Version 2.0).

MPL is like LGPL, but with static linking exception.

For many practical cases it means that you can use theCore in your proprietary embedded applications without disclosing the application source code.

Keep it private, if needed. MPL allows you to do that.

Pay note though, that MPL is still a copy-left license. So you are obligated to distribute any changes of theCore itself if there were any.

It is strongly recommended to read MPL 2.0 FAQ to get more familiar with it.

Technologies and projects used

Most notable are:

  • C++11 and C++14 - as a main programming language standards.
  • Python 3 and cog - code generation.
  • Doxygen and Sphinx - in-source and project-wide documentation.
  • CMake - build-system.
  • Nix - development environment management.
  • CppUTest and Unity - unit and on-device testing.
  • Travis - continuos integration.

Check the Credits section for more.

Contribution & Using

The project is on its very beginning, so any help is more than welcome and highly appreciated. If you’d like to take a part in the project growth and (or) have any questions – take a look at Community guidelines section, leave message at theCore Telegram group, mailing list, gitter, contact me directly at [email protected], or simply check out a list of theCore issues.

If you have any suggestions on theCore improvement or just like it how it is, don’t keep silence! I’ll be happy to read your reviews.

You are welcome to use theCore in your own projects. If there is something that it’s not enough for this, please let me know via email or open some issues and we will do our best to handle this ASAP. Good luck!

thecore's People

Contributors

forgge avatar gitter-badger avatar innusig avatar oleh-kravchenko avatar rasendubi avatar rostakagmfun avatar vadimol avatar velichechka avatar yverzun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thecore's Issues

Add I2S bus implementation

We need to implement i2s support for stm32f4xx platform.
It can be done within SPI bus implementation (same controller is used for I2S in stm32f4xx).

Add DMA support for I2C

For now i2c supports only polling and irq mode.
DMA support should be added to achieve high performance data flow

stm32f4xx: Provide convinient pinconfig wrappers

Pinconfig wrappers should cover following demands:

  • compile-time check of repeated reconfiguration of the same pin
  • batch pin configuration, when few pins within same port can be initialized together
  • strong checks against garbage pin parameters usage, such as using values dedicated for pin speed when configuring pin direction
  • etc.

Abort build for stm32f4xx platform if cross-compiler wasn't set

It is possible to trigger TheCore build using host compiler and get some strange errors:

[ 31%] Building C object core/platform/stm32f4xx/SPL/CMakeFiles/spl.dir/src/stm32f4xx_cryp_tdes.c.o
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c: In function ‘CRYP_TDES_ECB’:
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:108:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
   uint32_t keyaddr    = (uint32_t)Key;
                         ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:109:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
   uint32_t inputaddr  = (uint32_t)Input;
                         ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:110:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
   uint32_t outputaddr = (uint32_t)Output;
                         ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:131:53: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   TDES_CRYP_KeyInitStructure.CRYP_Key1Left = __REV(*(uint32_t*)(keyaddr));
                                                     ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:133:53: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   TDES_CRYP_KeyInitStructure.CRYP_Key1Right= __REV(*(uint32_t*)(keyaddr));
                                                     ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:135:53: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   TDES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
                                                     ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:137:53: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   TDES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
                                                     ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:139:53: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   TDES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
                                                     ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:141:53: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   TDES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
                                                     ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:159:18: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     CRYP_DataIn(*(uint32_t*)(inputaddr));
                  ^
/home/executor/projects/thecore/demo-example/core/platform/stm32f4xx/SPL/src/stm32f4xx_cryp_tdes.c:161:18: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     CRYP_DataIn(*(uint32_t*)(inputaddr));
                  ^

Reason is that cross-compiler wasn't set. It is hard to notice though.

stm32f4xx: SMBus interface for I2C driver

SMBUS, The System Management Bus is a single-ended simple two-wire bus for the purpose of lightweight communication.

While SMBus is derived from I²C, there are several major differences between the specifications of the two busses in the areas of electricals, timing, protocols and operating modes.

SMBus mode is supported by I2C periphery in stm32f4xx platform. TheCore's I2C driver can be extended with new mode and separate aliases can be provided for I2C and SMBus.

Another way to implement it is to use configuration structure that define mode that will be used.

Undefined reference to memcpy when using -flto flag

STOR:

  1. Remove attribute at memcpy (memcpy.c file) definition:

    //__attribute__((used))
    void * LIBC_FUNCTION(memcpy) (void *dst, const void *src, size_t cnt)
    {
    
  2. Build advaced_demo release or minsize configuration:

    VERBOSE=1 make advanced_demo_release -j5
    
  3. Observe results at the end of a build:

    <artificial>:(.text+0x108): undefined reference to `memcpy'
    <artificial>:(.text+0x45a): undefined reference to `memcpy'
    <artificial>:(.text+0x464): undefined reference to `memcpy'
    <artificial>:(.text+0x47c): undefined reference to `memcpy'
    

Workaround is to keep the used attribute.

Implement graphics library

Following components should be included:

  • fonts
  • basic primitives (line, circle etc.)
  • UI elements (textbox, areas etc.)
  • much, much more

Add error handling to i2c bus implementaion

For now i2c bus implementation does not support error handling. Actually device can hang in case of en error or glitch on a bus.
For polling we can use timeouts for operations.
For irq - there is a separate handler for errors.

Implement platform-level/IRQ debug console and asserts

Platform code cannot use ecl::cout object due to following reasons:

  • Stream could not be constructed and inited when platform code executes
  • Stream uses locks, which are prohibited in IRQ context
  • Stream depends on a console driver, which is a part of a platform. It is a cyclic dependency and must be omitted.

So additional implementation should be made.

Implement CS43L22 driver

The CS43L22 is a highly integrated, low power stereo DAC with headphone and Class D speaker amplifiers. The CS43L22 offers many features suitable for low power, portable system applications.

It is also placed on stm32f4 discovery.

References:
CS43L22 datasheet

Create code style guide

Including source-formatting script based on astyle.
Naming convention of the classes, functions, file names etc. must be included

stm32f4xx: EXTI driver

A special driver must be crafted that will dispatch incoming interrupts from GPIO lines. It must be taken into account that 16 lines of GPIO EXTI are mapped only to 7 EXTI IRQs.
See stm32f4xx EXTI tutorial for some details.

Implement MFRC522 driver, highly integrated RFID reader/writer

The MFRC522 is a highly integrated reader/writer IC for contactless communication at 13.56 MHz. It can be found in a cheap RFID reader/writer modules like this.

UART is preferable as communication mode between MCU and MFRC522.
Unit tests required.

Additional implementation inside existing code is also required:

  • #34 Configurable USART modes are required to support different baud rates.
  • #35 EXTI driver will supply the Core with interrupts from MFRC522
  • #36 FIFO read/write can be triggered while servicing EXTI IRQ. This will decrease response latency significantly.

Refs:
Datasheet.

Implement driver for LIS3DSH sensor

The LIS3DSH sensor is popular accelerometer sensor: http://www.st.com/content/ccc/resource/technical/document/datasheet/23/c3/ea/bf/8f/d9/41/df/DM00040962.pdf/files/DM00040962.pdf/jcr:content/translations/en.DM00040962.pdf

The STM32F4Discovery has lis3dsh on board and it is easy to evaluate it.

Sensor supports I2C and SPI interfaces, has FIFO and able to trigger EXTI interrups. It is pretty good instance to provide "live" testing of many components of TheCore.

Provide reliable semaphore based on FreeRTOS implementation

Currently, semaphore for FreeRTOS is just a wrapper for SemaphoreHandle_t
It can be used with restrictions of queue size which is limits how many events sempahore can accumulate.

Additional implementation required to let semaphore handle as much events as possible.

stm32f4xx: configurable usart module

Current implementation of the usart_bus platform module:

    // Configure UART
    // TODO: make configuration values be chosen at compile time
    init_struct.USART_BaudRate             = 115200;
    init_struct.USART_WordLength           = USART_WordLength_8b;
    init_struct.USART_StopBits             = USART_StopBits_1;
    init_struct.USART_Parity               = USART_Parity_No;
    init_struct.USART_Mode                 = USART_Mode_Rx | USART_Mode_Tx;
    init_struct.USART_HardwareFlowControl  = USART_HardwareFlowControl_None;

It contains hard-coded init values. The issue is about creating compile-time configuration of the particular usart bus.

NRF24L01 driver, single chip 2.4GHz transceiver

NRF24xxx is a single chip 2.4GHz transceiver with an embedded baseband protocol engine (Enhanced ShockBurst™), suitable for ultra low power wireless applications. The nRF24L01+ is designed for operation in the world wide ISM frequency band at 2.400 - 2.4835GHz.

It can be found as a part of low-cost RF modules, like this.

Official page states:

This product is not recommended for new designs. Nordic recommends its drop-in compatible
nRF24L01+ or for a System-on-Chip solution the Nordic nRF24LE1 or nRF24LU1+.

Issue must be changed if it is better to implement nRF24LE1 or nRF24LU1+ instead of NRF24L01.

Refs:
Official page
ElecFreaks WiKi
NRF24 product specification

Create toolchain-dependent module to hold specific function declarations

See sys.cpp file:

// TODO: move this to toolchain-dependent module
#if UINT32_MAX == UINTPTR_MAX
#define STACK_CHK_GUARD 0xe2dee396
#else
#define STACK_CHK_GUARD 0x595e9fbd94fda766
#endif

// TODO: move this to toolchain-dependent module
__attribute__((used))
uintptr_t __stack_chk_guard = STACK_CHK_GUARD;

// TODO: move this to toolchain-dependent module
extern "C" __attribute__((noreturn)) __attribute__((used))
void __stack_chk_fail(void)
{
    ecl::cout << "Fail!!!" << ecl::endl;
    for(;;);
}

These should be moved somewhere to better place.

Review console subsystem and configuration parameters

There are few issues exists:

  • ambiguous configuration name for stm32f4xx platform: CONFIG_CONSOLE_DEVICE_NUM
  • conversion algorithms are hard-coded in console streams (see istream.hpp) and cannot be reused within debug assertions.
  • bypass driver lacks puts()-like routines

More likely exist. These should be fixed.

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.