Extending FreeRTOS Development Environment

2y ago
27 Views
3 Downloads
4.42 MB
109 Pages
Last View : 25d ago
Last Download : 3m ago
Upload by : Mariam Herr
Transcription

Extending FreeRTOSdevelopment environment11000746Silvestrs TimofejevsUniversity of the West of England

Silvestrs Timofejevs11000746AcknowledgementsI wish to express my sincere gratitude to Craig Duffy, without whose help I would nothave achieved as high a standard of work.I would also like to mention the people who have made the most impact on methroughout the time in university: Ian Johnson, Rob Williams, Nigel Gunton.Finally, I would like to acknowledge the lovely geese family, who have made my nights inuniversity less lonely.1 Page

Silvestrs Timofejevs11000746Table of Contents1. Introduction. 41.1 Scope of the project. 41.2 Hardware Choice. 51.3 Project Planning and strategy.61.4 Project format. 62. Risk assessment. 73. Hardware. 93.1 GPIO s. 103.2 CIMSIS and the STM Standard Peripheral Library.113.3 Linker script. 143.4 Cortex-M3 boot sequence.183.5 JTAG and CoreSight debug interface.193.6 On-Chip Debugging and In-system programming.244. Libraries. 284.1 NewLib. 294.2 Reentrancy and thread safety.304.3 Reentrancy in NewLib and integration with FreeRTOS.314.4 Porting NewLib. 324.5 NewLib printf on a bare metal olimex STM32-P107.354.6 Hardware initialization.354.7 Printf relevant system calls.384.8 Main and the interrupt handler.415. FreeRTOS. 435.1 Documentation. 435.2 Porting FreeRTOS.445.3 FreeRTOS interrupts configuration.515.4 A simple application running FreeRTOS.535.5 Debugging. 536. FreeRTOS IO. 556.1 FreeRTOS IO structure.566.2 Porting FreeRTOS IO.586.3 FreeRTOS IO types, definitions and prototypes.596.4 FreeRTOS open. 646.5 FreeRTOS ioctl. 686.6 FreeRTOS read. 716.7 FreeRTOS write. 726.8 Interrupt Service Routines.752 Page

Silvestrs Timofejevs110007466.9 Macros and debug.786.10 Integration with NewLib.787. FreeRTOS CLI. 817.1 Fundamentals of the FreeRTOS CLI.828. Conclusion. 848.1 STMCube. 858.2 Words of praise to FreeRTOS and STMicroelectronics.868.3 Work assessment.869. Bibliography. 88Appendix A. 91Cortex-M3 exception model.91Exception types. 92Nested Vectored Interrupt Controller (NVIC).93Appendix B. 96Development tools and environment.96GNU tools and utilities. 963 Page

Silvestrs Timofejevs110007461. IntroductionIn modern society, computer technology is an ever-growing field, which has expandedexponentially in the last couple decades, and is promising to advance even faster pace.Some computer systems are used on daily basis, usually such systems are labelled –interactive. Interactive systems imply user interaction: personal computers, gadgets,laptops and many other. A larger group of computer systems is usually hidden from theunaware public – embedded systems. An embedded system can be a part of a biggersystem, it often have to comply with certain Real-Time constrains, and is expected torun continuously without the human interaction. Just as an overview of the size of theembedded market – every year there are more than 1.5 billion ARM based processorssold alone. [1]Computer systems are designed to satisfy different requirements, involving differenttypes of hardware, an ability to run different software. Personal computers are oftenrequired to work with graphics or other highly resource consuming tasks. Suchsystems must have vast amounts of RAM, powerful CPU and a graphics card.Embedded systems strive for the lowest cost and energy efficiency, and usually have gotmany constraints to be taken into account.Interactive and modern mobile systems, usually are powerful enough, and can benefitfrom larger Operating Systems. Such Operating Systems could be: Windows, Linuxdistributions, iOS, Android, etc. Deeply embedded systems might have RAM limited toonly several kilobytes. Even the Linux kernel, which can be shrunk to less than amegabyte of size – can be too heavy for some deeply embedded systems. Thus, deeplyembedded systems often are only able to run a simple scheduler and/or use lightweightlibraries.1.1 Scope of the projectEmbedded systems play a huge role in our daily lives, yet many of us fail to recognisethe importance. It is a common approach by the software developers to use the Linuxkernel in mobile and embedded systems, there are good reasons behind it. Linux is a4 Page

Silvestrs Timofejevs11000746free, open source Operating System, there are number of extremely powerfuldevelopment tools that make the development process so much easier. Unfortunately,smaller embedded systems are not always capable of running a Linux build. The idea ofthis project is the research of smaller operating systems and set of standard libraries tobe used within the deeply embedded computer systems, and explore the possibilities ofthe improvement of the development environment of such systems.The Real-Time Operating System (RTOS) that I have chosen for the project - FreeRTOS,a free and open source RTOS. The source code consists of just several C source andheader files, hence it has a very small memory footprint, and allows it to fit withconstrain of even the smallest embedded systems. It has grown from being a simpleexecutive to an almost complete Real-Time Operating System. FreeRTOS has got a greatsupport, and there are number of additional modules provided with the source code. Itallows the developer to add or exclude certain components, making the FreeRTOS buildmore flexible and configurable. FreeRTOS lacks certain features common in the betterknown Operating Systems, such as memory management, access control, etc.FreeRTOS has been around on the market for some time, however is still a relativelynew product, and is in the phase of an active development. [3]Working with different Operating Systems and hardware, I can conclude that one of themajor reasons of the popularity of those products – is the development environment.The popularity of Linux in the embedded market comes from the scalability andextremely powerful and mature utilities that can be used with it. Linux has got a greatnumber of development tools – binutils, buildroot, OpenEmbedded, OpenOCD andmany more that make the programming experience easier and more efficient. The goalof the project is to explore the possibilities of improving the FreeRTOS developmentenvironment. It will include the investigation into the additional software modulesprovided with the FreeRTOS source, and use of the C libraries with the FreeRTOSbuild.I think this project could be a subject of an interest amongst the people who havedecided to use FreeRTOS, or the STM32 microcontroller in their development.Throughout the project I will strive to cover the hardware configuration andexploitation, as well as the porting of FreeRTOS and C library/libraries.5 Page

Silvestrs Timofejevs110007461.2 Hardware ChoiceThe project is based on the Olimex STM 32-P107 development board, which has got anARM Cortex-M3 based microcontroller unit from STMicroelectronics. The Olimexdevelopment board has all the necessary interfaces to satisfy the needs of the project. Ithas also got a space for soldering additional electronic components, which could beuseful if the project is considered for further experimental developments. It is a good achoice in terms of price/capabilities. [2]1.3 Project Planning and strategyThe project consists of porting FreeRTOS and extending development environment. Theinitial idea was to port the uClibc (standard C library for the uClinux build, and manyother custom Linux builds) onto the STM32P107VCT6 – the microcontroller unit of theOlimex STM32-P107 development board. Although, having a look around the opensource C libraries, the decision has been made to use NewLib instead. Soon after thefirst research efforts, it became apparent that the system does not benefit from the fullfunctionality spectre provided by uClibc. A decision was made to use NewLib instead,with the possibility of adding extensions by porting relevant parts of uClibc. The maingoal of the project is to build a BusyBox like CLI, and incorporate with a customized Clibrary.Why porting is a better idea than writing the software from scratch? Libraries that havebeen used extensively throughout a period of time, and across different hardware – willusually be in a stable state, with majority of bugs tested and fixed. Any newdevelopment will almost certainly contain bugs, and in widely used software across thesystem, it is very difficult to foresee all potential problems. And most importantly, thereis no need, and not enough time to “reinvent the wheel”.1.4 Project formatThis document introduces the reader with hardware, firmware and softwaredevelopment tools. The design of the document follows an incremental format, whereprocesses described in earlier chapters, are generally relevant to the development in6 Page

Silvestrs Timofejevs11000746later chapters; in other words, by the end of this report the reader should be familiarwith the development stages – starting with the low level hardware configuration,followed by NewLib and FreeRTOS.The project follows a less conventional structure, where there is no dedicated research,design or development. There is no need to have a designated design section, becausethe software components used are the end products. However, the reader is introducedto some design concepts in chapters describing the relevant software.2. Risk assessmentThe project is a research into development and improvement of the FreeRTOSdevelopment environment. The bulk of the development process falls intoporting different software products to cooperate together, gather informationand provide ground for future development. The project does not claim to havea particular end product, with potential beneficiaries being the developersconducting or looking into FreeRTOS and the functionality it provides.The main risks associated with the project are: Time management:Being a research project, it is almost impossible to foresee whether someof the initially planned features and goals can be achieved. There is arisk that the amount of work originally estimated between the subtasksof the project may sway in one the other way; Hardware malfunction:Working with hardware the possibility of it being corrupted shouldalways be considered, the main risk is not having back-up equipment, ora long wait period before the replacement can be obtained; Possibility of someone developing an identical type of software first:7 Page

Silvestrs Timofejevs11000746It is possible that someone had a similar idea, and develops the productfirst, which would give the competitor an advantage in the market.Reflecting on the first issue – time management, the inability to achieve theinitial goals, in a research project (particularly in an Open Source project) couldbe as valuable as an achievement of the set goals. Well supported conclusionthat an attempted task cannot be carried out, could be a valuable contributionamongst the developers.Hardware malfunction in some cases could be a serious bottleneck, if thedevelopment of a system relies on corrupted software. However, the hardwareused in this project, is relatively cheap and available for order online.Possibility of someone developing software, which is targeting the same area,could be disastrous in commercial projects, or even in the Open Source projectsintended for a specific end user. However, this project is more of a contributionto the Open Source community, rather than anything else; which means thatproduction of same purpose software is even beneficial, as two projects can becompared, and potentially merged into one.8 Page

Silvestrs Timofejevs110007463. HardwareFigure 1 [2] TM32F107VCT6 microcontroller, with the following features: CPU: STM32F107VCT6 32 bit ARM-based microcontroller with 256 KBFlash, 64 KB RAM; USB OTG, Ethernet, 10 timers, 2 CANs, 2 ADCs, 14 communicationinterfaces; JTAG connector with ARM 2 10 pin layout for programming/debugging; USB OTG connector; USB HOST connector; 100Mbit Ethernet; RS232; Mini SD/MMC card connector; UEXT connector;9 Page

Silvestrs Timofejevs11000746 Power jack; Two user buttons; RESET button and circuit; Two status LEDs; Power-on LED; 3V battery connector; Extension port connectors for many of microcontroller’s pins; PCB: FR-4, 1.5 mm (0,062"), soldermask, silkscreen component print; Dimensions: 132.08 96.52mm (5.2 3.8").ARM dominates the embedded market, the majority of smartphones run ARMbased Microcontroller Units. There is a good reason: ARM products are cheapand efficient, 32bit processors cost almost as little as some 8bit processorsfrom different vendors. ARM architecture tends to pursue maximal powersaving capabilities and are leading microprocessor designers in the area.3.1 GPIO sGeneral Purpose Input Output (GPIO), are microcontroller pins that serve as abridge between the development board and a microcontroller unit. GPIO pinsare a critical resource, one GPIO pin may have more than one function. Most ofthe communication interfaces on the board use GPIO alternate functionmapping – an Input/output pin is mapped to an interface circuit on themicrocontroller, instead of being accessible through an IO port. This meansthat if you will write to a GPIO Pin, whilst it is in the “Alternate Function” state,it will take no effect. Microcontroller vendors often strive to utilize GPIO pins asefficiently as possible, which means that GPIO pins can have more than oneAlternate Function. When GPIO pin has got multiple Alternate Functions, input10 P a g e

Silvestrs Timofejevs11000746will propagate into all the Alternate Function peripherals associated with thatpin. The simultaneous output from multiple peripherals will probably result incorrupted data. The peripherals can be remapped to different GPIO s, whichmeans that if you are planning utilize multiple peripherals associated with thepin, you can remap them onto a different port. [4] Otherwise, to work withdesired peripheral, you will have to disable the other peripherals associatedwith the GPIO pin in use. Below you can see a schematic of a standard IO portbit.Figure 2 [4]By default GPIO pins and communication interfaces are not enabled, it isdesigned this way for power saving reasons. In order to enable a GPIO port oran interface, the corresponding unit has to be clocked. CIMSIS provides all thenecessary routines to configure and manipulate the hardware (please refer tothe CIMSIS and the STM Standard Peripheral Library chapter).3.2 CIMSIS and the STM Standard Peripheral LibraryThe Cortex-M3 is growing in the embedded market, ARM strives forstandardization. The goal of the CIMSIS is to provide better inter-operabilitywith different ARM based microcontroller software. [24] Everything in software11 P a g e

Silvestrs Timofejevs11000746development tends towards reusability, ease of use and portability. It is notnecessary that these goals are always achieved, but in practice a good productalways strives to provide it. We can extend our analogy to programminglanguages, “C” programming language emerged for similar reasons. Before“high” level programming languages software development was carried outpredominantly in assembly programming language, which is machine specific.Intermediate ground had been found in addition of extra abstraction layer –“high” level language. “C” programming language is probably the best knownand most used in software industry. CIMSIS principle is different yet similar.Standard defines a set of functions and corresponding names that have to beimplemented by hardware vendors. [24]I find it necessary to include an overview of the CIMSIS compliant library fromST Microelectronics, and provide an introduction of the library tree structure,as well as to describe the functionality of different components. TheImplementation in this project relies on the Standard Peripheral Library, and itis important to at least understand the basics.Figure 312 P a g e

Silvestrs Timofejevs11000746The directory that we are interested in the most is called “Libraries”, it containstwo further subdirectories:CMSIS: [24] Under

The project consists of porting FreeRTOS and extending development environment. The initial idea was to port the uClibc (standard C library for the uClinux build, and many other custom Linux builds) onto the STM32P107VCT6 – the microcontroller unit of the Olimex STM32-P107 development

Related Documents:

Power Management Implementation in FreeRTOS on LM3S3748 201 3 FreeRTOS FreeRTOS is a free and open source real time operating system designed to have small footprint and targeted to embedded systems [6]. It is written in C language and does not contain drivers, support for

APIs for tasks, semaphores, mutexes, timers, and so forth. HALCoGen is a GUI-based driver generating tool for the Hercules family of devices. HALCoGen also supports FREERTOS for various devices in the Hercules family. It enables users to generate the FREERTOS code, along with other drivers. This application report provides an overview on FreeRTOS.

FreeRTOS is a real -time kernel /scheduler designed to be small enough to run on a m icrocontroller. It provides the real time scheduling functionality, inter -task communication, timing analysis and synchronization primitives for teaching RTOS. It also offers the rich example projects as the bases for developing embedded real -time systems.

Extending IBM Rational Functional Tester with Open SourceTools: Part 2: Database test. Page 1 of 14 Extending IBM Rational Functional Testerwith Open Source Tools: Part 2: Database test automation Scripting against SQuirreL SQL Level: Intermediate Daniel Gouveia (dgouveia@us.ibm.com), Software Technical Sales Specialist, IBM 26 Dec 2007

The Extending Dreamweaver CS5 guide describes the Adobe Dreamweaver CS5 framework and application programming interface (API) that lets you build extensions to Dreamweaver. The Extending Dreamweaver CS5 guide provides information about: † How each type of extension works † The API functions that Dreamweaver calls to implement the .

PlatformIO is a professional collaborative platform for embedded development that support multiple IDE including Eclipse 800 target boards (development kits) 20 software frameworks (Arduino, ARM mbed, CMSIS, ESP-IDF, FreeRTOS, STM32Cube, Zephyr RTOS, and others)

– Professional grade solution for GUI development based on SEGGER emWin solution. – Optimized display drivers. – Software tools for code generation and bitmap editing (STemWin Builder ). FreeRTOS – Open source standard. – CMSIS compati

Introduction: From Figure to Field There are, in fact, no cities anymore. It goes on like a forest. —Ludwig Mies van der Rohe, 1955 Landscape has recently emerged as model and medium for the contemporary city. This claim has been available since the turn of the twenty-first century in the discourse and practices the term “landscape urbanism” describes. This volume offers the first .