UM1819 User manual. Demonstration firmware for STM32091C-EVAL board. Introduction



Similar documents
UM1721 User manual. Developing Applications on STM32Cube with FatFs. Introduction

AN4646 Application note

UM1727 User manual. Getting started with STM32 Nucleo board software development tools. Introduction

UM1680 User manual. Getting started with STM32F429 Discovery software development tools. Introduction

AN3354 Application note

UM1727 User manual. Getting started with STM32 Nucleo board software development tools. Introduction

UM1790 User manual. Getting started with STM32L053 discovery kit software development tools. Introduction

32F072BDISCOVERY. Discovery kit for STM32F072xx microcontrollers. Features. Description

AN4571 Application note

UM1969 User manual. Getting started with STM32F746G discovery software development tools. Introduction

AN3990 Application note

STM32F4DISCOVERY. Discovery kit with STM32F407VG MCU. Features. Description

Getting started with software and firmware environments for the STM32F0DISCOVERY kit

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

AN3265 Application note

Hello, and welcome to this presentation of the STM32L4 reset and clock controller.

32F769IDISCOVERY. Discovery kit with STM32F769NI MCU. Features

AN3332 Application note

STSW-IDW002. Hands-On Training for SPWF01SC and SPWF01SA Wi-Fi modules. Features. Description

UM0834 User manual. Developing and debugging your STM8S-DISCOVERY application code. Introduction. Reference documents

Getting started with the X-CUBE-SOUNDTER1 sound terminal software expansion for STM32Cube

AN3998 Application note

AN3252 Application note

Figure 1. STM32F429 Discovery board: STM32F429I-DISCO

AN3997 Application note

UM1676 User manual. Getting started with.net Micro Framework on the STM32F429 Discovery kit. Introduction

Java Embedded Applications

UM0985 User manual. Developing your STM32VLDISCOVERY application using the IAR Embedded Workbench software. Introduction

UM1075 User manual. ST-LINK/V2 in-circuit debugger/programmer for STM8 and STM32. Introduction

AN655 R ANGE TEST APPLICATION FOR EZRADIO AND EZRADIOPRO. 1. Introduction. 2. Supported Radio Types

Tutorial for MPLAB Starter Kit for PIC18F

Lab Experiment 1: The LPC 2148 Education Board

AN2557 Application note

Quick Start Guide. MRB-KW01 Development Platform Radio Utility Application Demo MODULAR REFERENCE BOARD

Software User Guide UG-461

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

UM1075 User manual. ST-LINK/V2 in-circuit debugger/programmer for STM8 and STM32. Introduction

M24LRxx/CR95HF application software installation guide

AN4296 Application note

AN4032 Application note

Atmel AVR4903: ASF - USB Device HID Mouse Application. Atmel Microcontrollers. Application Note. Features. 1 Introduction

CB-OLP425 DEVELOPMENT KIT GETTING STARTED

AN4108 Application note

PAC52XX Clock Control Firmware Design

AN3270 Application note

UM0853 User manual. 1 Introduction. M24LRxx application software user guide

Quick Start Guide. TWR-MECH Mechatronics Board TOWER SYSTEM

AN2824 Application note

ACR880 GPRS Portable Smart Card Terminal

Software Real Time Clock Implementation on MC9S08LG32

UM1724 User manual. STM32 Nucleo boards. Introduction

AVR115: Data Logging with Atmel File System on ATmega32U4. Microcontrollers. Application Note. 1 Introduction. Atmel

SPC5-FLASHER. Flash management tool for SPC56xx family. Description. Features

How To Use An Atmel Atmel Avr32848 Demo For Android (32Bit) With A Microcontroller (32B) And An Android Accessory (32D) On A Microcontroller (32Gb) On An Android Phone Or

AT89C5131A Starter Kit... Software User Guide

Bootloader with AES Encryption

STEVAL-IEG001V2. Smart real-time vehicle tracking system. Features

AN4128 Application note

AXIS Camera Station Quick Installation Guide

UM1734 User manual. STM32Cube USB device library. Introduction

TWR-KV31F120M Sample Code Guide for IAR Board configuration, software, and development tools Rev.0

Introduction. Getting familiar with chipkit Pi

UM1906 User manual. STM32CubeF7 demonstration platform. Introduction

3.2 inch QVGA TFT Color LCD User s Guide Version 1 & 2

SUDT AccessPort TM Advanced Terminal / Monitor / Debugger Version 1.37 User Manual

RN-131-PICTAIL & RN-171-PICTAIL Evaluation Boards

M68EVB908QL4 Development Board for Motorola MC68HC908QL4

MX PIC24F Educational Module User Manual

AN3969 Application note

TivaWare USB Library USER S GUIDE SW-TM4C-USBL-UG Copyright Texas Instruments Incorporated

How To Use A Pkn10 (Powerline) With A Microsd Card (Powerkit) On A Powerline (Powergen) Or Powerline 2 (Powerbee) (Powerbmi) (Pk10) (Operating

AN3155 Application note

BLE113 DEVELOPMENT KIT

PC Base Adapter Daughter Card UART GPIO. Figure 1. ToolStick Development Platform Block Diagram

Capacitive Touch Lab. Renesas Capacitive Touch Lab R8C/36T-A Family

Getting started with DfuSe USB device firmware upgrade STMicroelectronics extension

Freescale Semiconductor, I

UM0462 User manual. STM32 and STM8 Flash loader demonstrator. Introduction

USER GUIDE. ZigBit USB Stick User Guide. Introduction

USER GUIDE EDBG. Description

LonManager PCC-10 and ISA Protocol Analyzers Models and

AN4156 Application note

MCB3101 (Class I) WiRobot Serial Bluetooth Wireless Module User Manual

APPLICATION NOTE. AT17284: Proximetry Cloud Based Smart Plug User Guide. SMART ARM-based Microcontrollers. Introduction. Features

AN2680 Application note

AN10866 LPC1700 secondary USB bootloader

Using the TASKING Software Platform for AURIX

PCAN-MicroMod Universal I/O Module with CAN Interface. User Manual. Document version ( )

Embedded Display Module EDM6070

USBSPYDER08 Discovery Kit for Freescale MC9RS08KA, MC9S08QD and MC9S08QG Microcontrollers User s Manual

FAT on SD Card. AN Application Note. Introduction

APPLICATION. si32library. Callback CMSIS HARDWARE. Figure 1. Firmware Layer Block Diagram

RN-131-PICTAIL & RN-171-PICTAIL Web-Server Demo Application

UM0586 User manual. STM32 Cryptographic Library. Introduction

BE635 User Manual. Rev. V Bolymin, Inc. All Rights Reserved.

STDP4328. DisplayPort 1.2a concentrator. Features. Applications

LEN s.r.l. Via S. Andrea di Rovereto 33 c.s CHIAVARI (GE) Tel Fax mailto: len@len.it url: http//

How To Write To An Eeprom Memory On A Flash Memory On An Iphone Or Ipro Memory On Microsoft Flash Memory (Eeprom) On A Microsoft Microsoft Powerbook (Ai) 2.2.2

ES_LPC4357/53/37/33. Errata sheet LPC4357/53/37/33. Document information

FLYPORT Wi-Fi G

Transcription:

User manual Demonstration firmware for STM32091C-EVAL board Introduction The STM32CubeF0 Demonstration comes on top of the STM32Cube as a firmware package that offers a full set of software components based on a modules architecture allowing re-using them separately in standalone applications. All these modules are managed by the STM32Cube Demonstration kernel allowing to dynamically adding new modules and access to common resources (storage, graphical and components). The STM32CubeF0 Demonstration is built on the light kernel and on services provided by BSP, components, based on the STM32Cube HAL, using almost the whole STM32 capability to offer a large scope of usages. Figure 1. STM32091C-Evaluation board October 2014 DocID026947 Rev 1 1/43 www.st.com

Contents UM1819 Contents 1 Demonstration description.................................... 6 1.1 Demonstration folder organization............................... 6 1.2 Demonstration Architecture overview............................. 7 2 Demonstration functional description.......................... 9 2.1 Menu..................................................... 9 2.2 Demo startup...............................................11 2.3 Navigation................................................ 13 2.4 Modules.................................................. 13 2.4.1 Thermometer............................................. 13 2.4.2 8xUART................................................. 14 2.4.3 Low power organization..................................... 15 2.4.4 About................................................... 20 2.4.5 File Browser.............................................. 21 2.4.6 Image viewer............................................. 22 3 Hardware settings.......................................... 23 4 Software settings.......................................... 25 4.1 Clock Control.............................................. 25 4.2 Peripherals................................................ 25 4.3 Media files................................................ 25 4.4 Programming the demonstration............................... 26 4.4.1 Using Binary file........................................... 26 4.4.2 Using preconfigured projects................................. 26 5 Software description........................................ 27 5.1 Application................................................ 27 5.2 Application startup overview................................... 27 5.3 Kernel.................................................... 28 5.3.1 Overview................................................ 28 5.3.2 K_demo................................................. 29 5.3.3 K_menu................................................. 29 2/43 DocID026947 Rev 1

Contents 5.3.4 K_module................................................ 30 5.3.5 K_Storage............................................... 30 5.3.6 K_tools.................................................. 31 5.3.7 K_Window............................................... 31 5.3.8 Memory management...................................... 31 5.4 Module................................................... 32 5.5 Module control............................................. 32 5.5.1 K_ModuleItem_Typedef..................................... 32 5.5.2 kmodulepreexec & kmodulepostexec......................... 33 5.5.3 kmoduleexec............................................. 34 5.5.4 kmoduleressourcecheck................................... 34 5.6 Graphical aspect........................................... 35 5.6.1 The structure tmenu........................................ 35 5.6.2 The structure tmenuitem.................................... 35 5.6.3 Menu Architecture......................................... 35 5.7 Functionality............................................... 36 5.8 Adding a new module........................................ 37 5.9 Middleware (FatFS)......................................... 37 6 Footprint.................................................. 39 6.1 Kernel footprint............................................. 39 6.2 Module footprint............................................ 39 6.3 HAL footprint.............................................. 40 6.4 BSP footprint.............................................. 40 6.5 BSP components footprint.................................... 41 6.6 Third party footprint......................................... 41 7 Revision history........................................... 42 DocID026947 Rev 1 3/43 3

List of tables UM1819 List of tables Table 1. Default jumper s configuration.............................................. 24 Table 2. Peripherals............................................................. 25 Table 3. Function Description...................................................... 27 Table 4. Files kernel list.......................................................... 28 Table 5. K_demo_Start function description........................................... 29 Table 6. K_menu function description............................................... 29 Table 7. K_module function description.............................................. 30 Table 8. K_Storage function Description............................................. 31 Table 9. K_tools function description................................................ 31 Table 10. K_Window function description.............................................. 31 Table 11. K_ModuleItem_Typedef................................................... 32 Table 12. tmenu structure.......................................................... 35 Table 13. tmenuitem structure...................................................... 35 Table 14. APIs functions description................................................. 37 Table 15. Software consumption.................................................... 39 Table 16. Kernel footprint consumption............................................... 39 Table 17. Module footprint consumption............................................... 39 Table 18. HAL footprint consumption................................................. 40 Table 19. BSP footprint consumption................................................. 41 Table 20. BSP components footprint consumption....................................... 41 Table 21. Third party footprint consumption............................................ 41 Table 22. Document revision history................................................. 42 4/43 DocID026947 Rev 1

List of figures List of figures Figure 1. STM32091C-Evaluation board............................................... 1 Figure 2. Demonstration folder organization............................................ 6 Figure 3. Demonstration Architecture overview.......................................... 7 Figure 4. Demonstration main menu.................................................. 9 Figure 5. Structure of the demonstration menus........................................ 10 Figure 6. SD card detection error.................................................... 11 Figure 7. SD card resource Error.................................................... 11 Figure 8. ST Logo............................................................... 12 Figure 9. Demonstration main menu................................................. 12 Figure 10. Temperature display...................................................... 13 Figure 11. 8xUARTs loopback....................................................... 14 Figure 12. Low power menu........................................................ 15 Figure 13. Stop mode entered with EXTI............................................... 16 Figure 14. Setting wakeup time...................................................... 16 Figure 15. Stop mode entered, wait RTC alarm......................................... 17 Figure 16. Standby mode entered, press JOY_sel to exit & reset............................ 18 Figure 17. Standby mode started, wait RTC alarm....................................... 19 Figure 18. About menu............................................................ 20 Figure 19. File browser display...................................................... 21 Figure 20. STM32091C_EVAL board................................................. 23 Figure 21. SD Card directory organization.............................................. 25 Figure 22. Application startup overview................................................ 28 Figure 23. K_menu execution flow.................................................... 30 Figure 24. kmodulepreexec example:................................................. 33 Figure 25. kmodulepostexec example:................................................ 33 Figure 26. kmodule example:........................................................ 34 Figure 27. kmoduleressourcecheck.................................................. 34 Figure 28. menu architecture inside a module.......................................... 36 DocID026947 Rev 1 5/43 5

Demonstration description UM1819 1 Demonstration description The demonstration has been designed with three main objectives: Toolkit with low memory consumption. Modular applications: independents with high level of reuse. Basic menu navigation through joystick. 1.1 Demonstration folder organization Figure 2. Demonstration folder organization 6/43 DocID026947 Rev 1

Demonstration description The demonstration sources are located in the Projects folder of the STM32Cube package for each supported board, here in STM32091C_EVAL folder. The sources are divided into five groups described as follows: Binary: demonstration binary file in Hex format Config: all middleware s components and HAL configuration files Core: contains the kernel files Demo: contains startup files Modules: contains user modules including the graphical aspect and the modules functionalities. SD_card: resource files required by the demo that should be present in SD card Project settings: a folder per tool chain containing the project settings and the linker files. 1.2 Demonstration Architecture overview Figure 3. Demonstration Architecture overview DocID026947 Rev 1 7/43 42

Demonstration description UM1819 The STM32CubeF0 Demonstration is composed of: Application: in charge to initialize kernel, HAL, interrupt handler and launch the main module Kernel: module scheduler and services provider (popup, files system, ) Module: graphical aspect and application execution Middleware: Only FATFS used STM32Cube HAL & BSP: provide access to HW and external component 8/43 DocID026947 Rev 1

Demonstration functional description 2 Demonstration functional description 2.1 Menu The purpose of the demonstration is to bring out the capabilities of microcontroller and Evaluation board peripherals. It runs only on the STM32091C_EVAL board. The demonstration contains the following applications. (Refer to Figure 4) Figure 4. Demonstration main menu The UP, DOWN, RIGHT and LEFT joystick directions allow the user to navigate between items in the main menu and the submenus. To enter a submenu, press the SEL push-button. The SEL push-button designates the action of vertically pressing the top of the joystick, as opposed to moving it horizontally UP, DOWN, RIGHT or LEFT. DocID026947 Rev 1 9/43 42

Demonstration functional description UM1819 Figure 5. Structure of the demonstration menus 10/43 DocID026947 Rev 1

Demonstration functional description 2.2 Demo startup After a board reset, at demo startup, the system checks if a SD card memory is present in connector CN8. If no card is detected, the demo does not start and the message shown in Figure 6 is displayed on the LCD screen. Figure 6. SD card detection error The demo continues only if an SD card is inserted. Then, each module will check if all needed graphic icons & bitmap files are present on SD card. If some resources are missing, the below message appears on the screen, and the demo does not continue. Figure 7. SD card resource Error DocID026947 Rev 1 11/43 42

Demonstration functional description UM1819 If all needed files are well present in SD Card memory, STM32091C_EVAL welcome screen is displayed and ST logo appears on LCD (see Figure 8). Figure 8. ST Logo Finally, the main menu is displayed as shown in Figure 9, and user can start enjoying applications. Figure 9. Demonstration main menu Note: Some icons shown in Figure 9 are taken from wikimedia Once a submenu has been pre-selected, the associated icon is highlighted in blue color, the name of the module is displayed at the top of the screen. 12/43 DocID026947 Rev 1

Demonstration functional description 2.3 Navigation The demonstration menu is based on circular navigation, submenu selection, item selection and back navigation. User navigates using joystick push-button located on evaluation board: RIGHT, LEFT, SEL, UP and DOWN. UP, DOWN, RIGHT and LEFT push-buttons are used to perform circular navigation in main menu and current menu items. SEL push-button selects the current item. UP and DOWN push-buttons are used for vertical navigation in submenus. 2.4 Modules The following section provides a detailed description of each module of demonstration. 2.4.1 Thermometer Overview The STM32F091VCT6 microcontroller has two embedded I2C peripherals that can be connected to any device supporting the I2C protocol. A STLM75 (or a compatible device) I2C temperature sensor is mounted on the STM32091C-EVAL board and used to capture the external temperature (-55 C to +125 C). Once Temperature submenu has been selected by pressing SEL push-button, temperature value is displayed in Celsius and Fahrenheit as shown in Figure 10. Figure 10. Temperature display Press DOWN key to return to the main menu. DocID026947 Rev 1 13/43 42

Demonstration functional description UM1819 2.4.2 8xUART Overview This module intends to demonstrate the new capability of the STM32F091VCT6, to ensure Data buffer transmission and reception over 8 UARTs. Hardware configuration STM32091C_EVAL board is equipped with a new CN1 header for all UART Tx/Rx. Before running this application, user shall ensure that all UARTs are chained together thanks to jumpers plugged on dedicated connector CN1. Also, jumper JP1 should be fitted in position 2<->3 in order to route (UART1Rx) PA10 to CN1. Functional description In this module, a transmit Buffer is predefined with a 180 chars string, that will be transmitted/received in loop by packet of 18 data through all 8 UARTs. User will be able to monitor the number of packets transmitted/received on each UART, and the number of full transfer loops achieved. Figure 11. 8xUARTs loopback Note: Press DOWN key to return to the main menu. In case one of the jumpers on CN1 is removed during the loopback test, the packet transmission/reception will be stopped. 14/43 DocID026947 Rev 1

Demonstration functional description 2.4.3 Low power organization Overview STM32F091VCT6 microcontroller provides different operating modes in which the power consumption is reduced. The purpose of this menu is to show the behavior of microcontroller in different low-power modes. The Stop and Standby modes are taken as examples. Figure 12. Low power menu Functional description: STOP mode This menu allows user to put STM32F091VCT6 in STOP mode with Low power regulator ON and wake it up in two different ways: 1. Tamper button configured as External Interrupt (WFI) Press JOY_SEL to enter STOP mode. When the MCU is in Stop mode, the message shown in Figure 13 is displayed on the LCD. DocID026947 Rev 1 15/43 42

Demonstration functional description UM1819 Figure 13. Stop mode entered with EXTI MCU remains in Stop mode until Tamper push-button is pressed. System clock is then set to 48 MHz and the application resumes execution. 2. RTC Alarm (WFE) When selecting this submenu, user has to set alarm delay when MCU has to exit from Stop mode. Figure 14 shows how to set the wakeup time, using JOY_UP, JOY_DOWN, JOY_LEFT, JOY_RIGHT. Figure 14. Setting wakeup time Wakeup time is validated after a press on JOY_SEL, and MCU enters then in STOP mode. 16/43 DocID026947 Rev 1

Demonstration functional description Figure 15. Stop mode entered, wait RTC alarm RTC Alarm wakes up MCU from Stop mode after programmed time has elapsed. The system clock is then restored to 48 MHz and application resumes execution. STANDBY mode This menu allows user to put STM32F091VCT6 in Standby mode, and wake it up in two different ways: 1. JOY_SEL button configured as Wake-up pin Wakeup push-button is used to wake up the MCU from the Standby mode. Once the Standby mode> EXIT Wakeup submenu has been selected, user shall then press SEL push-button to allow the system entering Standby mode. DocID026947 Rev 1 17/43 42

Demonstration functional description UM1819 Figure 16. Standby mode entered, press JOY_sel to exit & reset MCU remains in Standby mode until Wakeup push-button is pressed. Once the Wakeup push-button has been pressed, MCU exits Standby mode and program execution resets. 2. RTC Alarm When selecting this submenu, user has to set alarm delay when MCU has to exit from Standby mode. RTC Alarm wakes up the MCU from the Standby mode after the programmed time has elapsed. When selecting this submenu, the user has to set the alarm to the time when the MCU has to exit from Standby mode. User can set the wakeup time, using JOY_UP, JOY_DOWN, JOY_LEFT, JOY_RIGHT. Once Wakeup time is validated with a press on JOY_SEL, MCU enters then in STANDBY mode. 18/43 DocID026947 Rev 1

Demonstration functional description Figure 17. Standby mode started, wait RTC alarm After the programmed timing has elapsed, the system exits the Standby mode and program execution resets. DocID026947 Rev 1 19/43 42

Demonstration functional description UM1819 2.4.4 About Overview This submenu shows version & date of STM32091C_EVAL demo firmware. When About menu is selected, the message shown in Figure 18 is displayed on the LCD screen. Figure 18. About menu Press DOWN key to return to the main menu. 20/43 DocID026947 Rev 1

Demonstration functional description 2.4.5 File Browser Overview File browser module is a system module that allows exploring the folder USER from connected storage unit(s) here SD card. It allows user to display file information and browse sub-directories. The file list structure is built during the media connection. Figure 19. File browser display Functional description File browser is light and allows basic file system operations like: explore folder, file information. Others operations like file deletion or opening supported extension file are not supported. Pressing UP/DOWN joystick allows user to browse files and sub- directories. When subdirectory is selected (highlighted in green), user can enter it by pressing joy selector. Pressing joystick LEFT, allows to go up in File System structure or go back to main menu, if already in root directory. DocID026947 Rev 1 21/43 42

Demonstration functional description UM1819 2.4.6 Image viewer Overview Image viewer module allows to retrieve BMP images stored on SD card & to display them in full screen on the LCD. When Image viewer is selected, a first image is displayed on the screen. User can then use RIGHT or LEFT push-button to view next/previous image stored on SD card. This application reads all bitmap pictures from USER directory (see Section 4.4: Programming the demonstration) and displays only the BMP files having the following format: Bit depth: 16 bits (RGB) Size: 240x320 Press DOWN or UP push-button to return to main menu. 22/43 DocID026947 Rev 1

Hardware settings 3 Hardware settings The STM32Cube demonstration supports STM32F091xC device and runs on STM32091C_EVAL board from STMicroelectronics. Figure 20. STM32091C_EVAL board For the STM32091C-EVAL board the following default jumper s configuration is used. DocID026947 Rev 1 23/43 42

Hardware settings UM1819 Table 1. Default jumper s configuration Jumper Position description JP18 JP17 JP15 JP14 JP13 JP12 JP11 Not fitted fitted: Speaker amplifier enabled Only STlk is fitted to power the board from USB or ST-LINK/V2-1 <1-2>: Mono playback enabled RS232 fitted: RS232_RX is connected to RS232 transceiver and RS232 communication is enabled fitted Not fitted JP10 <1-2>: VDDIO2 connected to 3.3V JP9 <2-3> JP8 JP7 JP6 fitted <1-2>: VBat pin connected to VDD fitted JP5 <1-2> JP4 JP3 JP2 JP1 CN1 Not fitted <1-2>: CAN receiver working in high-speed mode Not fitted <2-3> (used for USARTx look-back test) All jumpers should be fitted 24/43 DocID026947 Rev 1

Software settings 4 Software settings 4.1 Clock Control STM32F091VCT6 internal clocks are derived from the HSE (clocked by the external 8 MHz crystal). In this demo application, the various system clocks are configured as follows: System clock is set to 48 MHz: the PLL is used as the system clock source. HCLK frequency is set to 48 MHz. Only the RTC is clocked by a 32 khz external oscillator. 4.2 Peripherals All used peripherals are described in Table 2 Table 2. Peripherals Used peripherals Application/Module I2C1 EXTI GPIO PWR RCC RTC SPI UART Temperature sensor Menu navigation + joystick + push-button + low power mode + audio + Applications All Applications Low power modes application All Applications + Demo kernel Low power mode application Color LCD + SD card 8xUART application 4.3 Media files STM32091C_EVAL board comes with a MicroSD card memory preprogrammed with Image resources, txt files and directories tree used by demonstration FW. However, you can load your own image (*.bmp) files in the USER directory, assuming that file formats are supported by the demonstration. Figure 21. SD Card directory organization DocID026947 Rev 1 25/43 42

Software settings UM1819 4.4 Programming the demonstration User can program the demonstration using two methods: 4.4.1 Using Binary file To program demonstration s binary image into the internal Flash memory, you have to use the STM32CubeF0_Demo_STM32091C_EVAL.hex file located under Project\STM32091C- EVAL\Binary. 4.4.2 Using preconfigured projects Select the folder corresponding to your preferred toolchain (MDK-ARM, EWARM or TrueSTUDIO). Open STM32F091C-EVAL_Demo project and rebuild all sources. Load the project image through your debugger. Restart the evaluation board (press B1: reset button). 26/43 DocID026947 Rev 1

Software description 5 Software description Following sections will describe in details: Application: in charge to initialize kernel, HAL, interrupt handler and launch the main module Kernel: module scheduler and services provider (popup, files system, ) Module: graphical aspect and application execution Middleware: Only FATFS used 5.1 Application The application goal is to prepare demonstration startup, by initializing all the HW/SW before the main module execution (first action done by the kernel is to run a default module ID, please refer to chapter k_demo for more detail). Table below provides a description of all the actions performed by the different functions. Table 3. Function Description Functions (Main.c) Descriptions Main kmodule_init kdemo_initialization kdemo_uninitialization HAL_GPIO_EXTI_Callback initialize the HAL, configure the clock and start the demonstration Initialize the kmodule with all the modules Initialize the LCD, check SD state, initialize FatFs, display the startup window, initialize the module and check the modules resources Implemented however performs no action According the PIN id forward SD detection or Joystick event to kernel The file stm32f0xx_it.c is also part of the application and is used, as usual, to map the interrupt vector on the driver HAL driver, depending on the module requirement. 5.2 Application startup overview The following graph summarizes the application startup until the kernel takes the lead. DocID026947 Rev 1 27/43 42

Software description UM1819 Figure 22. Application startup overview 5.3 Kernel 5.3.1 Overview The goal of demonstration kernel is mainly to provide a generic platform that controls and monitors all the modules with minimum memory consumption. The kernel provides also a set of friendly services that simplifies module s implementation. Table below provides files kernel list with a short description. Table 4. Files kernel list Kernel K_demo K_menu K_module K_storage K_tools K_window Description Initialize the demo Handle the menu navigation and functionality execution Initialize the module Provide a set of function around the storage Provide a set of function tools Provide a set of function to display a popup window 28/43 DocID026947 Rev 1

Software description 5.3.2 K_demo The function Kdemo_Start is executed by the application to launch modules scheduling and the kernel starts by running the module with ID=MODULE_MAIN_APP. To keep the kernel independent with the HW/SW, functions KDemo_initialization and KDemo_UnInitialization are defined on application side and called by kdemo_start (see application chapter for details about these functions) Table 5. K_demo_Start function description Function KDemo_Initialization kdemo_uninitialization kdemo_start kdemo_execute Description Initialize the demo (function defined on application side) Initialize the demo (function defined on application side) Start the demo (Initialize, Run, UnInitialize, Exit) Initialize kmenu and execute the module MODULE_MAIN_APP 5.3.3 K_menu The module execution is started by a call to the function kmenu_execute. This kernel function handles the menu navigation and the execution functionalities (thanks to the structure t_menu defined inside the module). Table 6. K_menu function description Function kmenu_init kmenu_eventhandler KMenu_Execute kmenu_header kmenu_handleselectionexecute Description Initialize the joystick GPIO Event handler Function to execute a menu Function to display header information The function handle the menu navigation The Graph below shows the execution flow for a menu: DocID026947 Rev 1 29/43 42

Software description UM1819 Figure 23. K_menu execution flow 5.3.4 K_module Table 7. K_module function description Function kmodule_init kmodule_add kmodule_checkressource kmodule_execute Description Defined on application side Add module inside the module list Check the module resource Execute the module This kernel part centralizes information about all modules available inside demonstration fw; Function kmodule_init (defined on application side) aims to register all the modules present whit the help of function kmodule_init (thanks to the structure K_ModuleItem_Typedef defined inside the module). 5.3.5 K_Storage The K_Storage handles only the SD card storage and provides some services to simplify the modules development. 30/43 DocID026947 Rev 1

Software description Table 8. K_Storage function Description Function Description kstorage_init kstorage_deinit kstorage_getstatus kstorage_getdirectoryfiles kstorage_fileexist kstorage_getfileinfo kstorage_openfiledrawbmp kstorage_openfiledrawpixel kstorage_getext Mount the SD card file system Unmount the file system Return SD card presence Return the name of the file present inside a directory Check if a file exist Return file information Open a bmp file and display it (only file of 8ko max) Open a bmp file and display it line by line Return the file extension 5.3.6 K_tools The K_Tools provides tools for module development. Table 9. K_tools function description Function Description ktools_buffercmp Return 0 if the both buffers are identical 5.3.7 K_Window The k_window provides services to display popup window without user event management (must be handled outside, for example inside the module). Table 10. K_Window function description Function Description kwindow_popup kwindow_error Display a popup Display a red popup with an error message 5.3.8 Memory management Nothing specific to optimize the memory management, only two recommendations: kernel is recursive, so the stack allocation must be aligned with the deep of the modules chains. Each module allocates memory, for optimization purpose the allocation must be done on the heap (kmodulepreexec allocate and kmodulepreexec release the memory) DocID026947 Rev 1 31/43 42

Software description UM1819 The demonstration is currently using: CSTACK = 0x1800 HEAP = 0x3000 5.4 Module A module is an autonomous application that can run directly from the launcher or from another module. The module contains two main parts: Module control: the kernel used this part to handle the display and interact with the end-user. Functionalities: execution function(s) 5.5 Module control 5.5.1 K_ModuleItem_Typedef This structure is equivalent to a main function for the module: Table 11. K_ModuleItem_Typedef File code[byte] kmoduleid kmodulepreexec kmoduleexec kmodulepostexec kmoduleressoucecheck Unique ID module (defined inside k_config.h) the function is used to allocate memory or to execute any specific action before the module execution (this function is optional) Entry point used to start the main menu of the module The function is used to release the resource allocation done inside kmodulepreexec (this function is optional) Function used to control if the resource of the module are available (this function is optional) 32/43 DocID026947 Rev 1

Software description 5.5.2 kmodulepreexec & kmodulepostexec Both functions are optional and used mainly for memory optimization (memory allocated only when the module is running) Figure 24. kmodulepreexec example: Figure 25. kmodulepostexec example: DocID026947 Rev 1 33/43 42

Software description UM1819 5.5.3 kmoduleexec This function is mainly used to execute the module and start the menu execution of the modules. Figure 26. kmodule example: 5.5.4 kmoduleressourcecheck The function is used to control if resources are available: for example control if bmp file are well present on the SD card. Figure 27. kmoduleressourcecheck 34/43 DocID026947 Rev 1

Software description 5.6 Graphical aspect The graphical aspect consists in describing, inside structure, the menu architecture. 5.6.1 The structure tmenu This structure is the main entry point used by function kmenuexecute, to display the module MMI and execute the functionalities. Table 12. tmenu structure File code[byte] psztitle psitems nitems ntype line column Menu title Pointer on the menu data Number of entry inside menu data pointer Menu Type: TYPE_ICON, TYPE_TEXT, TYPE_EXEC In case of icon, number of icon line In case of icon, number of icon column 5.6.2 The structure tmenuitem This structure is the menu item description Table 13. tmenuitem structure File code[byte] psztitle Menu title x, y Icon position on the screen Type de selection SEL_EXEC: execute a functionality SelType SEL_SUBMENU: select a sub menu SEL_EXIT: exit the current menu and return to previous menu or module SEL_MODULE: execute a module ModuleId pfexecfunc pfactionfunc pssubmenu Module ID Function to execute Callback used to capture the user feedback Pointer on a submenu 5.6.3 Menu Architecture The figure below shows an example of a basic menu structure with the use of two modules: The module Main is built with two levels of menu and three functionalities. The level main is an ICON menu which can execute another module, execute the function1 or DocID026947 Rev 1 35/43 42

Software description UM1819 display a sub TEXT. This submenu can execute functionsub1, functionsub2 or go back on Main Menu. The module App1 is a TEXT with 2 embedded functionalities function1, function2. Figure 28. menu architecture inside a module 5.7 Functionality Functionality is an action selected by the end-user through the menu. This menu event will call of a function which must respect the following prototype: void functionexec(void) On the function exit, the kernel will return into the previous menu state. In many cases, the functionality will be stopped by an user event. So the kernel offers the capability to return all the events through a callback function with the following prototype: void functionsel(uint8_t sel) The functionality settings are done inside tmenuitem through the fields: pfexecfunc and pfactionfunc. 36/43 DocID026947 Rev 1

Software description 5.8 Adding a new module Once the module appearance and functionality are defined and created, based on constraints described above, only the module is left to be added: 1. Define unique ID of the new module in k_config.h file. 2. k_moduleadd() function should be called in KDemo_Initialization (), with unique ID defined in step1. 3. Modify main module to add the call to this new module (See Figure 28). 5.9 Middleware (FatFS) Only one middleware has been integrated inside the demonstration toolkit: FatFS. The full APIs functions set given by the file system interface are: Table 14. APIs functions description Function Description f_mount f_open f_close f_read f_write f_lseek f_truncate f_sync f_opendir f_readdir f_getfree f_stat f_mkdir f_unlink f_chmod f_utime f_rename f_mkfs f_forward f_chdir f_chdrive f_getcwd f_gets Register/Unregister a work area Open/Create a file Close a file Read file Write file Move read/write pointer, Expand file size Truncate file size Flush cached data Open a directory Read a directory item Get free clusters Get file status Create a directory Remove a file or directory Change attribute Change timestamp Rename/Move a file or directory Create a file system on the drive Forward file data to the stream directly Change current directory Change current drive Retrieve the current directory Read a string DocID026947 Rev 1 37/43 42

Software description UM1819 Table 14. APIs functions description (continued) Function Description f_putc f_puts f_printf Write a character Write a string Write a formatted string 38/43 DocID026947 Rev 1

Footprint 6 Footprint This chapter sums up Ram / Rom consumption per software blocks. Here is full demonstration software consumption: Table 15. Software consumption Full demonstration software Read only code memory [Byte] Read only data [Byte] Read Write data memory [Byte] 55150 18272 25500 6.1 Kernel footprint The following table shows the code memory, data memory and the constant memory used for each kernel file: Table 16. Kernel footprint consumption File Read only code memory [Byte] Read only data [Byte] Read Write data memory [Byte] k_demo 60 - - k_menu 1436-4 k_module 220-160 k_storage 884 52 1111 k_tools 38 - - k_window 252 12 - main 682 204 - Note: In this section, memory is sometimes allocated dynamically in some structures in order to save maximum RAM consumption. 6.2 Module footprint The following table purpose shows the code memory, data memory and the constant memory for each module: Table 17. Module footprint consumption Module Read only code memory [Byte] Read only data [Byte] Read Write data memory [Byte] 8uart_app 3264 692 65 filesbrowser_app 1852 304 2330 imagesbrowser_app 240 84 2 DocID026947 Rev 1 39/43 42

Footprint UM1819 Table 17. Module footprint consumption (continued) Module Read only code memory [Byte] Read only data [Byte] Read Write data memory [Byte] lowpower_app 1 624 824 34 main_app 308 552 1 thermometer_app 324 176 1 Note: In this section, memory is sometimes allocated dynamically in some structures in order to save maximum RAM consumption. 6.3 HAL footprint The following table purpose shows the code memory, data memory and the constant memory for each HAL file: Table 18. HAL footprint consumption Module Read only code memory [Byte] Read only data [Byte] Read Write data memory [Byte] stm32f0xx_hal 116-4 stm32f0xx_hal_cortex 304 - - stm32f0xx_hal_gpio 1152 - - stm32f0xx_hal_i2c 2208 - - stm32f0xx_hal_msp_tem plate 2 - - stm32f0xx_hal_pwr 156 - - stm32f0xx_hal_rcc 396 16 - stm32f0xx_hal_rcc_ex 2404 32 - stm32f0xx_hal_rtc 1256 - - stm32f0xx_hal_spi 1996 - - stm32f0xx_hal_uart 2116 - - stm32f0xx_hal_uart_ex 356 - - 6.4 BSP footprint The following table purpose shows the code memory, data memory and the constant memory for each BSP file: 40/43 DocID026947 Rev 1

Footprint Table 19. BSP footprint consumption Module Read only code memory [Byte] Read only data [Byte] Read Write data memory [Byte] stm32091c_eval 2276 55 200 stm32091c_eval_lcd 1536 14836 920 stm32091c_eval_sd 1450 1 1 stm32091c_eval_tsensor 156-6 6.5 BSP components footprint The following table purpose shows the code memory, data memory and the constant memory for each BSP component file: Table 20. BSP components footprint consumption Module Read only code memory [Byte] Read only data [Byte] Read Write data memory [Byte] hx8347d 1228 28 697 spfd5408 1204 28 697 stlm75 224 8 16 6.6 Third party footprint The following table purpose shows the code memory, data memory and the constant memory for each Third party (FatFS) file: Table 21. Third party footprint consumption Module Read only code memory [Byte] Read only data [Byte] Read Write data memory [Byte] diskio 220 ff 7924 144 30 ff_gen_drv 84 12 sd_diskio 268 11 21 DocID026947 Rev 1 41/43 42

Revision history UM1819 7 Revision history Table 22. Document revision history Date Revision Changes 24-Oct-2014 1 Initial release. 42/43 DocID026947 Rev 1

IMPORTANT NOTICE PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries ( ST ) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST s terms and conditions of sale in place at the time of order acknowledgement. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products. No license, express or implied, to any intellectual property right is granted by ST herein. Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product. ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces information previously supplied in any prior versions of this document. 2014 STMicroelectronics All rights reserved DocID026947 Rev 1 43/43 43