#format rst #language de ES2-Themen zur freien Beschäftigung =================================== H\. Högl, 22. November 2023, RTOS ---- Ideen - Mehrere quasiparallele Tasks definieren - Synchronisationsmittel testen - Taskwechsel auf dem Logikanalysator untersuchen - Resourcen verwalten ("Gatekeeper Task") - RTOS und Low-Power, "Tickless" Betriebsart - Alternative RTOS, z.B. RIOT, https://www.riot-os.org, `Wikipedia `_ Lesestoff * https://hhoegl.informatik.hs-augsburg.de/es2/skript/rtos.html * Elecia White, Making Embedded Systems, Kap. 6, Managing the flow of activity https://learning.oreilly.com/library/view/making-embedded-systems/9781098151539/ch06.html#tasks_idoKw0AO * Jim Ledin, Architecting High-Performance Embedded Systems, Kap. 3 Operating in Real Time https://learning.oreilly.com/library/view/architecting-high-performance-embedded/9781789955965/B12994_03_Final_JM_ePub.xhtml * Joseph Yiu, Kap. 19, Using Embedded Operating Systems https://learning.oreilly.com/library/view/the-definitive-guide/9780124080829/xhtml/CHP019.html * Daniele Lacamera, Kap. 10, Paralel Tasks and Scheduling https://learning.oreilly.com/library/view/embedded-systems-architecture/9781803239545/B18730_10.xhtml * Beispielprogramme - STM32CubeF4/Projects/STM32446E_EVAL/Applications/FreeRTOS/FreeRTOS_* Programmierung -------------- * C, C++ * Cube LL, HAL * Frameworks/IDEs: STM32 CubeIDE, Arduino (stm32duino.com), Mbed (https://os.mbed.com) * Meta-Framework: Platformio (https://platformio.org) * Alternative Bibliotheken: https://libopencm3.org * Netzwerkprogrammierung: lwIP, mbedTLS, wolfSSL (mit `B-L475E-IOT01A `_) * Filesystem: FatFS (http://elm-chan.org/fsw/ff), JesFS (https://github.com/joembedded/JesFs) * GUI: https://lvgl.io * Alternative Sprachen - Interpreter: Micropython, Lua, JavaScript (https://www.espruino.com) - TinyGo - Rust - Artikel von Joseph Yiu, 2013. Geht ein auf Java, MatLab/SimuLink, Arduino, Mbed, Statemachines, Ada. https://hhoegl.informatik.hs-augsburg.de/es2/prog/01_Yiu_the-Many-Ways-of-Programming-a-ARM-Cortex-M-microcontroller.pdf * Elektor Artikelserie "Bare-Metal Programming" von Sergey Liubka (Teil 3: Mongoose OS, Webserver) - https://hhoegl.informatik.hs-augsburg.de/es2/Elektor-Bare-Metal/ - https://github.com/cpq/bare-metal-programming-guide Low-Power Programmierung ------------------------ * STM32CubeF4/Projects/STM32446E-Nucleo/Examples/PWR/PWR_CurrentConsumption/ * Abschätzung Laufzeit von batteriebetriebenen Geräten * https://www.st.com/en/development-tools/stm32cubemonpwr.html * X-NUCLEO-LPM01A zur Messung der Stromaufnahme https://www.st.com/en/evaluation-tools/x-nucleo-lpm01a.html * Reinhard Keil, Frank Grobe, Designing Energy-Efficient Systems with Cortex-M Microcontrollers https://hhoegl.informatik.hs-augsburg.de/es2/prog/keil_grobe_energyeff.pdf * Microchip, Low-Power Design Guide (nimmt zwar einen PIC16 als konkretes Beispiel, der Inhalt gilt aber auch für andere Controller) https://hhoegl.informatik.hs-augsburg.de/es2/prog/Microchip-AN1416-Lowpower.pdf * https://hhoegl.informatik.hs-augsburg.de/es2/skript/lowpower.html Debuggen -------- * Cube Monitor https://www.st.com/en/development-tools/stm32cubemonitor.html * Tracing über SWO (Serial Wire Output) Pin des STM32 - Blog Eintrag https://www.codeinsideout.com/blog/stm32/swv/ - Buch von Joseph Yiu, Kap. 14 (Debug and Trace) https://learning.oreilly.com/library/view/the-definitive-guide/9780124080829/xhtml/CHP014.html * Segger "Real Time Transfer" (RTT) https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer * Keil Event Rekorder, "Real Time Events" https://www.keil.com/pack/doc/compiler/EventRecorder/html/index.html USB ---- Ideen - USB Maus simulieren (HID Class); STM32 als USB Device - USB UART (CDC Class); STM32 als USB Device - USB Massenspeicher (MSC Class); STM32 als USB Host - USB OTG (Host und Device abwechselnd) Hinweise - Das Nucleo F446 hat keine USB Buchse die direkt an den F446 geht, deshalb benötigt man noch ein USB Breakout Board: https://www.berrybase.de/usb-micro-b-breakout-board - STM32CubeF4/Middlewares/ST/STM32_USB_Device_Library/ - STM32CubeF4/Middlewares/ST/STM32_USB_Host_Library/ - Beispiele unter - STM32CubeF4/Projects/STM32446E_EVAL/Applications/USB_Host/ - STM32CubeF4/Projects/STM32446E_EVAL/Applications/USB_Device/ Literatur - "USB in a Nutshell" https://www.beyondlogic.org/usbnutshell/usb1.shtml Bootloader ---------- Boot-Kanäle: USART, CAN, SPI, I2C, USB DFU * Lacamera, Kap. 4, "The Boot-Up Procedure" https://learning.oreilly.com/library/view/embedded-systems-architecture/9781803239545/B18730_04.xhtml * AN2606 https://www.st.com/resource/en/application_note/an2606-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf * AN3155 https://www.st.com/resource/en/application_note/an3155-usart-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf * Der STM32 CubeProgrammer kann über den USART und das Bootloaderprotokoll (AN3155) auf den Mikrocontroller zugreifen (zusätzlich auch über JTAG, SWD, USB DFU). https://www.st.com/en/development-tools/stm32cubeprog.html * AN3156 (USB DFU) https://www.st.com/resource/en/application_note/cd00264379-usb-dfu-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf https://dfu-util.sourceforge.net https://dfu-util.sourceforge.net/dfuse.html * Der von ST Micro vorgegebene Bootloader ist im ROM gespeichert, kann also nicht geändert werden. Man kann aber zusätzlich einen selbstgeschriebenen Bootloader im Flash-Speicher ablegen. Ein praktisches Feature von meist selbstgeschriebenen Bootloadern ist "Firmware Over The Air Update" (FOTA).