EclipseArmebs4/DemoProjects
Marc.pignat (Talk | contribs) |
m (→BOARD_XXX) |
||
(10 intermediate revisions by one user not shown) | |||
Line 8: | Line 8: | ||
All our sample (and labs) code use the <code>libheivs_stm32</code> library, it source can be found at svn+https://repos.hevs.ch/svn/armebs4/trunk/libheivs_stm32. | All our sample (and labs) code use the <code>libheivs_stm32</code> library, it source can be found at svn+https://repos.hevs.ch/svn/armebs4/trunk/libheivs_stm32. | ||
This is an eclipse project that must be checked out into the eclipse workspace. This project can't be build, it is linked into other projects and compiled directly into | This is an eclipse project that must be checked out into the eclipse workspace. This project can't be build, it is linked into other projects and compiled directly into | ||
− | them. | + | them. The library project should be closed, this will ease file search. |
+ | |||
+ | [[File:libheivs_link.png|center|frame|The <code>_MODEL</code> project showing the <code>libheivs_stm32</code> linked into the project. The library project itself can be closed.]] | ||
+ | |||
+ | A lot of work has been done on integration and minimizing dependencies. For instance, when FreeRTOS is used, the standard <code>malloc</code>(<code>calloc</code>, <code>realloc</code>) and <code>free</code> from are using the allocation functions of FreeRTOS (<code>pvPortMalloc</code>/<code>vPortFree</code>). | ||
+ | |||
+ | == Almost a normal program == | ||
+ | The <code>main</code> function is called with stdio routed to the serial port, and malloc/free function are functional (even without OS). | ||
+ | Before main, all IOs are already configured to non-destructive default values. | ||
=== Configurable modules === | === Configurable modules === | ||
<div id="config_mod"></div> | <div id="config_mod"></div> | ||
− | Several libraries have integrated into our library. The <code>heivs</code> and <code>stm32</code> parts mostly contain drivers and support code and are therefore mandatory. Each project can configure optional modules by modifying the project's '''<code>[[#See config_h|config/config.h]]</code>''' file. | + | Several libraries have integrated into our library. The <code>heivs</code> and <code>stm32</code> parts mostly contain drivers and support code and are therefore mandatory. Each project can configure optional modules by modifying the project's '''<code>[[#See config_h|config/config.h]]</code>''' file and the '''[[#See exclude|exclude from build]]''' option. |
{|class=wikitable | {|class=wikitable | ||
! style="text-align:left;"|Name | ! style="text-align:left;"|Name | ||
Line 40: | Line 48: | ||
|- | |- | ||
|} | |} | ||
− | |||
− | |||
− | |||
== ''<code>current_project/</code>''<code>config/config.h</code> == | == ''<code>current_project/</code>''<code>config/config.h</code> == | ||
Line 70: | Line 75: | ||
|- | |- | ||
|} | |} | ||
+ | |||
+ | == Exclude from build == | ||
+ | <div id="exclude"></div> | ||
+ | Unused libraries can be excluded from build to improve compilation time. This has been done on every sample project. | ||
+ | |||
+ | To enable or disable the build: | ||
+ | * Go to the project explorer | ||
+ | * Right-click in your_project/libheivs/src/__module__ | ||
+ | * Select "Resource configuration/Exlude from build...". When the box is checked, the selected module is disabled. | ||
+ | |||
+ | <gallery mode="packed"> | ||
+ | File:exclude_select.png | Resource configuration/Exlude from build... | ||
+ | File:excluded_cmsis.png | <code>cmsis</code> is checked -> it will not be built | ||
+ | </gallery> | ||
== newlib's <code>iprintf/iscanf</code> == | == newlib's <code>iprintf/iscanf</code> == | ||
Line 75: | Line 94: | ||
for instance the <code>vf'''i'''printf</code> can be used instead of <code>vfprintf</code> where floating point is not required. | for instance the <code>vf'''i'''printf</code> can be used instead of <code>vfprintf</code> where floating point is not required. | ||
− | == | + | == BOARD_XXX == |
− | + | Several boards are supported (see libheivs/include/heivs/bsp.h). For the ARMEBS4, the <code>BOARD_ARMEBS4</code> symbol MUST be define in ''Project->Properties->C/C++ Build->Settings->Cross GCC Compiler->Symbols''. | |
− | == | + | == The <code>heivs_bus_t</code> abstraction == |
− | + | The (serial) buses are available using a common abstraction layer. Common functions are provided for the SPI, UART and I2C buses. | |
+ | '''''Warning : ''''' At this time this interface is blocking, a non-blocking version is expected soon. | ||
+ | == In brief == | ||
+ | * <code>bus_init</code> must be called once before using a bus. This function will initialize the pins and the bus controller. | ||
+ | * <code>bus_get</code> and <code>bus_release</code> are synchronization functions and must be called before bus accesses. | ||
+ | * <code>bus_read</code>, <code>bus_write</code> and <code>bus_writeread</code> are data access functions. | ||
+ | Full documentation : <code>[http://armebs4doc.hevs.ch/group__bus.html heivs_bus_t]</code> | ||
== Sample projects == | == Sample projects == |
Latest revision as of 10:06, 21 April 2016
Some sample code is available in the subversion repository, please have a look at the First steps page.
The sample projects are located in the trunk/demos/PROJECT_NAME
directory.
libheivs_stm32
All our sample (and labs) code use the libheivs_stm32
library, it source can be found at svn+https://repos.hevs.ch/svn/armebs4/trunk/libheivs_stm32.
This is an eclipse project that must be checked out into the eclipse workspace. This project can't be build, it is linked into other projects and compiled directly into
them. The library project should be closed, this will ease file search.
A lot of work has been done on integration and minimizing dependencies. For instance, when FreeRTOS is used, the standard malloc
(calloc
, realloc
) and free
from are using the allocation functions of FreeRTOS (pvPortMalloc
/vPortFree
).
Almost a normal program
The main
function is called with stdio routed to the serial port, and malloc/free function are functional (even without OS).
Before main, all IOs are already configured to non-destructive default values.
Configurable modules
Several libraries have integrated into our library. The heivs
and stm32
parts mostly contain drivers and support code and are therefore mandatory. Each project can configure optional modules by modifying the project's config/config.h
file and the exclude from build option.
Name | Version | Brief | Provider | License | config/config.h
|
---|---|---|---|---|---|
heivs | r640 | Board support package and more | ARMEBS4 team | FIXME | (mandatory) |
stm32 | 1.1.0 + custom changes | STM32 support | ST | unkown | (mandatory) |
ugfx | ? + custom changes | µGFX graphics library | µGFX | GFX License version 1.2 | USE_UGFX |
freertos | 8.0.0 + custom changes | FreeRTOS real time kernel | FreeRTOS | GPLv2 modified license | USE_FREERTOS |
cmsis | 1.4.3 + custom changes | CMSIS MCU Software Standard | ARM | CMSIS license | (automatic) |
fatfs | 0.10a + custom changes | Board support package | ChaN | custom - free software | USE_FATFS |
lwip | 1.4.1 + custom changes | A Lightweight TCP/IP stack | lwip | Modified BSD License | USE_LWIP |
jpeg | 9a + custom changes | libjpeg | ijg | custom - free software | USE_LIBJPEG |
cyassl | 3.2.0 + custom changes | Cryptographic and SSL library | yassl | GPLv2 | USE_CYASSL |
current_project/
config/config.h
Each project MUST contain the config/config.h
file which can define some compilation options. A complete and commented sample file can be found in libheivs_stm32/include/heivs/samples/config.h.txt
Define | Brief | Default |
---|---|---|
USE_UGFX, USE_FREERTOS, USE_FATFS, USE_LWIP, USE_FATFS, USE_LWIP, USE_LIBJPEG, USE_CYASSL | See Configurable modules | 0 (== desactivated) |
USE_STDIO_USART | Which serial port will be used for stdio | 0 (== use bus_usart[0] for stdio) |
USE_SEMIHOSTING | stdio using semihosting (over JTAG) | 0 (don't use semihosting) |
USE_STDIO_NOBUF | Disable stdio buffers | 1 (buffers disabled) |
USE_STDIO_ECHO | Echo every char received on stdin to stdout | 0 (no echo) |
USE_STDIO_AUTO_CR_BEFORE_LF | Fix stio line endings for Windows | 1 (add CR before LF) |
USE_STM32_LIB_ASSERT | Check most parameters of stm32 library functions | 0 (disabled) |
USE_STM32_USB_USE_DEVICE_MODE, USE_STM32_USB_HOST_MODE, USE_STM32_USB_OTG_MODE | stm32 USB stack configuration | 0 (disabled) |
Exclude from build
Unused libraries can be excluded from build to improve compilation time. This has been done on every sample project.
To enable or disable the build:
- Go to the project explorer
- Right-click in your_project/libheivs/src/__module__
- Select "Resource configuration/Exlude from build...". When the box is checked, the selected module is disabled.
newlib's iprintf/iscanf
newlib implements some lightweight versions of *printf and *scanf fuctions named *iprintf and *iscanf. These functions does not support floating point numbers.
for instance the vfiprintf
can be used instead of vfprintf
where floating point is not required.
BOARD_XXX
Several boards are supported (see libheivs/include/heivs/bsp.h). For the ARMEBS4, the BOARD_ARMEBS4
symbol MUST be define in Project->Properties->C/C++ Build->Settings->Cross GCC Compiler->Symbols.
The heivs_bus_t
abstraction
The (serial) buses are available using a common abstraction layer. Common functions are provided for the SPI, UART and I2C buses.
Warning : At this time this interface is blocking, a non-blocking version is expected soon.
In brief
-
bus_init
must be called once before using a bus. This function will initialize the pins and the bus controller. -
bus_get
andbus_release
are synchronization functions and must be called before bus accesses. -
bus_read
,bus_write
andbus_writeread
are data access functions.
Full documentation : heivs_bus_t
Sample projects
Every project contains:
- The basic configuration
- working settings for the compiler/linker
- BOARD_XXX is defined in properties/C/C++ Build/Cross GCC Compiler/Symbols
- config/config.h file : the configuration of the project
- project_name.lauch
- libheivs_stm32 -> an eclipse link to the libheivs_stm32 library
_MODEL
Sample project, mainly used for storing the default compile and debug configuration. This project is always up to date with the latest and best recommended settings.
Peripherals used : leds, buttons (polling)
mems
Display accelerometer and gyroscope values on the LCD.
Peripherals used : accelerometer, gyroscope, LCD
stdio
stdin/stdout example.
Peripherals used : serial port
buttons_interrupts
Copy the button values on the led and display the button's state on the serial port. This software use the BSP abstraction for buttons.
Peripherals used : buttons, serial port
gpio_interrupts
Same as buttons_interrupts, but using gpio_interrupts (not the BSP abstraction for buttons).
Peripherals used : gpio, serial port
hashes
Comparison of software and hardware MD5 implementation.
Peripherals used : hash engine
hello_cpp
Minimal project using C++
Peripherals used : serial port
hello_cpp_nano
Minimal project using C++ and newlib-nano. The newlib-nano library is smaller but some features are not available (C++ exception, no floating point printf, ...)
Peripherals used : serial port
hello_freertos
Simple FreeRTOS sample code, creates 3 task printing on the serial port and one task for each led.
Peripherals used : serial port
hello_lcd_freertos
Simple FreeRTOS + uGFX sample code. Print on the serial port when a graphical button is clicked and put chars from the keyboard on the screen.
Peripherals used : LCD, touchscreen, serial port, keyboard
leds_usb_serial_cdc
USB CDC echo. This sample code will create a pseudo serial over the USB and will echo back every character received.
Peripherals used : leds, USB slave
random
Test the random number generator from the stm32f4 family.
Peripherals used : RNG, serial port
sd_card
Test the micro SD/SDHC card, low-level access and filesystem (fat32) access
Peripherals used : SD, serial port
audio
Testing audio play and recording Peripherals used : buttons, audio interface
sections
Show how to force the compiler to use non-default section (using external RAM, ...)
Peripherals used : external RAM, serial port
spi_discovery
2d level for the STM32F4Discovery board (see BOARD_XXX).
Peripherals used : SPI, leds
stm32_camera
Using FreeRTOS, copy images from the camera to the display, jpeg images can be recorded over the USB CDC connection, PC side software in trunk/qsimplecam subversion directory.
Peripherals used : USB slave, camera, display
tcp_ip_freertos
FreeRTOS + lwip sample code, not well tested.
Peripherals used : Ethernet
test_cmsis_dsp
Test from the cmsis dsp library
Peripherals used : serial port
can
Testing the CAN bus.
Peripherals used : CAN, serial port
mp3_player_gpl (work in progress)
A webradio project licensed under the GPL. At this time it plays the "Couleur 3" swiss radio on the earphone output.
Peripherals used : Ethernet, lcd, touchscreen, audio
cyassl_test_gpl
Project licensed under the GPL, curently only testing DSA and ECDSA signature algorithms.
Peripherals used : serial port