Difference between revisions of "Using embOS in CMSIS-Pack projects"
(Created page with "'''embOS for Cortex-M''' complies to the '''Common Microcontroller Software Interface Standard (CMSIS)'''. In addition, SEGGER offers an '''embOS CMSIS-Pack''' that allows...") |
m |
||
(12 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
[[ARM]] introduced the ''Common Microcontroller Software Interface Standard (CMSIS)'' as a vendor-independent abstraction layer for simplifying software (re-)usage. The standard enables consistent and simple software interfaces e.g. to the [[CPU|processor]] and [[Peripheral|peripherals]], [[RTOS|real-time operating systems]] and other middleware. |
[[ARM]] introduced the ''Common Microcontroller Software Interface Standard (CMSIS)'' as a vendor-independent abstraction layer for simplifying software (re-)usage. The standard enables consistent and simple software interfaces e.g. to the [[CPU|processor]] and [[Peripheral|peripherals]], [[RTOS|real-time operating systems]] and other middleware. |
||
− | Since SEGGER is one of the CMSIS partners, embOS for Cortex-M is fully CMSIS-compliant and comes with a generic CMSIS start project that can be executed on any Cortex- |
+ | Since SEGGER is one of the CMSIS partners, embOS for Cortex-M is fully CMSIS-compliant and comes with a generic CMSIS start project that can be executed on any Cortex-M device. Further start projects for specific Cortex-M devices get shipped with embOS for Cortex-M as well (e.g. more than 170 start projects are provided with embOS for Cortex-M and [[Embedded Studio]]) and are also fully CMSIS-compliant. |
− | With the introduction of the ''embOS CMSIS-Pack'' |
+ | With the introduction of the ''embOS CMSIS-Pack'', CMSIS-compliant embOS projects may be created with ease for arbitrary Cortex-M devices using various IDEs. |
=== Download === |
=== Download === |
||
+ | The ''embOS CMSIS-Pack'' may be obtained from [https://www.segger.com/downloads/embos/SEGGER.CMSIS-embOS SEGGER.com]. |
||
− | The ''embOS CMSIS-Pack'' is part of the '''embOS expansion for STM32CubeMX''', but may also be used independently of ''STM32CubeMX'' (e.g. in ''IAR Embedded Workbench'' as well as ''arm Keil µVision''). |
||
− | <br /> |
||
− | This expansion may be obtained from [https://www.segger.com/downloads/embos/SEGGER.I-CUBE-embOS SEGGER.com]. |
||
− | |||
− | After download, the *.pack-file may be accessed or extracted like a *.zip-file and contains the following files and folders: |
||
− | [[File:ICUBE FolderStructure.png|none|embOS I-CUBE folder structure]] |
||
− | <br /> |
||
− | |||
− | {| class="seggertable" |
||
− | |- |
||
− | ! style="width: 25%;" | File / Folder || style="width: 70%;" | Description |
||
− | |- |
||
− | | ''Middlewares''\ || Contains the embOS documentation, pre-build libraries, include files and target source files for use with GNU, IAR and Keil toolchains |
||
− | |- |
||
− | | ''Projects''\ || Contains a pre-generated STM32CubeMX example project for the STM3240G-Eval board each for IAR Embedded Workbench, arm Keil µVision, and STM32CubeIDE |
||
− | |- |
||
− | | ''STM32CubeMX''\ || Contains additional source code templates for code generation using STM32CubeMX |
||
− | |- |
||
− | | License.txt || The license agreement under which this software pack is provided |
||
− | |- |
||
− | | ReadMe.txt || Trouble-shooting guide for this software pack (includes information on linker symbols used by embOS which may need to be added manually) |
||
− | |- |
||
− | | SEGGER.I-CUBE-embOS.pdsc || The Pack description file for this software pack |
||
− | |} |
||
=== Installation === |
=== Installation === |
||
− | The embOS |
+ | The ''embOS CMSIS-Pack'' may be used as-is: it does not need to be extracted before installing it in any CMSIS-Pack capable IDE. |
<br /> |
<br /> |
||
The following example installation is done using IAR Embedded Workbench, but should be similar for other IDEs: |
The following example installation is done using IAR Embedded Workbench, but should be similar for other IDEs: |
||
Line 41: | Line 18: | ||
# Open the ''CMSIS-Pack Manager'' via ''Project -> CMSIS-Pack Manager'' |
# Open the ''CMSIS-Pack Manager'' via ''Project -> CMSIS-Pack Manager'' |
||
# Inside the CMSIS-Pack Manager, select ''CMSIS-Manager -> Import existing packs'' |
# Inside the CMSIS-Pack Manager, select ''CMSIS-Manager -> Import existing packs'' |
||
− | # Import ''SEGGER. |
+ | # Import ''SEGGER.CMSIS-embOS.x.y.z.pack'' (e.g. ''SEGGER.CMSIS-embOS.1.0.1.pack'') |
This will extract the pack to your local ''IAR CMSIS-Pack repository'' and make it available in the IAR CMSIS-Manager as shown below: |
This will extract the pack to your local ''IAR CMSIS-Pack repository'' and make it available in the IAR CMSIS-Manager as shown below: |
||
Line 47: | Line 24: | ||
=== Usage === |
=== Usage === |
||
− | After |
+ | After successful installation, the embOS CMSIS-Pack can be used to generate example projects with embOS. |
<br /> |
<br /> |
||
Here, a project for a generic Cortex-M3 is created, but the same steps should be applied when creating a project for any specific device. |
Here, a project for a generic Cortex-M3 is created, but the same steps should be applied when creating a project for any specific device. |
||
Line 72: | Line 49: | ||
An optional embOS sample application may be added as well. |
An optional embOS sample application may be added as well. |
||
<br /> |
<br /> |
||
− | We recommend adding one of these to start with, for otherwise no ''main()'' will be included in the project and it will fail to build until |
+ | We recommend adding one of these to start with, for otherwise no ''main()'' will be included in the project and it will fail to build until that main() routine is added manually: |
* OS_Mutexes.c |
* OS_Mutexes.c |
||
* OS_Mutexes_CMSIS.c (may only be used when CMSIS-RTOS (v1) API was enabled) |
* OS_Mutexes_CMSIS.c (may only be used when CMSIS-RTOS (v1) API was enabled) |
||
Line 94: | Line 71: | ||
=== Trouble-shooting === |
=== Trouble-shooting === |
||
==== Linker Symbols with arm Keil µVision ==== |
==== Linker Symbols with arm Keil µVision ==== |
||
− | When creating projects for arm Keil µVision, manual modification may be required to the used start-up file (e.g. startup_stm32f407xx.s) |
+ | When creating projects for arm ''Keil µVision'', manual modification may be required to the used start-up file (e.g. startup_stm32f407xx.s). |
+ | |||
− | <br /> |
||
− | If the linker |
+ | If the linker complains about the undefined symbol ''Stack_Mem'', the ''Stack_Mem'' symbol needs to be exported by the start-up file (e.g. startup_stm32f407xx.s). |
+ | Please add |
||
EXPORT Stack_Mem |
EXPORT Stack_Mem |
||
to the start-up file. |
to the start-up file. |
||
+ | |||
+ | Alternatively, if another symbol pointing to the end of the stack (lowest address of the stack) is exported, OS_InitSysStackInfo.c can be modified to use this symbol instead of ''Stack_Mem''. |
||
+ | |||
+ | If the linker complains about the undefined symbol ''__initial_sp'', the ''__initial_sp'' symbol needs to be exported by the start-up file (e.g. startup_stm32f407xx.s). |
||
+ | Please add |
||
+ | EXPORT __initial_sp |
||
+ | to the start-up file. |
||
+ | |||
+ | Please note, that there might be conflicts with the stack/heap set up methods and ARM compiler V6 when ''__initial_sp'' is exported and MicroLIB is not used. |
||
+ | In this case, and if the start-up file supports the use of MicroLIB, MicroLIB can be enabled instead of exporting ''__initial_sp'' (Options for Target -> Target -> Code Generation -> Use MicroLIB). |
||
+ | |||
+ | Alternatively, if another symbol pointing to the beginning of the stack (highest address of the stack) is exported, OS_InitSysStackInfo.c can be modified to use this symbol instead of ''__initial_sp''. |
||
==== Linker Symbols with GNU toolchains ==== |
==== Linker Symbols with GNU toolchains ==== |
||
Line 110: | Line 100: | ||
__stack_end__ = .; |
__stack_end__ = .; |
||
in the linker file. |
in the linker file. |
||
+ | |||
+ | ==== Conflicting types for malloc() functions with GNU toolchains ==== |
||
+ | When creating projects for GNU toolchains, embOS may be used with ''newlib'' standard libraries but not e.g. ''redlib'' standard libraries.<br /> |
||
+ | Usage of redlib will result in compiler errors as shown below: |
||
+ | [[File:embOSRedlibIncompatibiliy.JPG|none|1200px|Compiler errors when using embOS and redlib in GCC-based projects]] |
||
+ | |||
+ | To resolve this, please select ''newlib'' in the project options: |
||
+ | [[File:SelectingNewlibinEclipse.jpg|none|Selecting newlib in Eclipse-based IDEs]] |
Latest revision as of 10:16, 22 August 2023
embOS for Cortex-M complies to the Common Microcontroller Software Interface Standard (CMSIS). In addition, SEGGER offers an embOS CMSIS-Pack that allows users to generate and configure embOS projects for virtually all Cortex-M devices and various IDEs. This article provides further information on its usage.
Contents
Introduction
ARM introduced the Common Microcontroller Software Interface Standard (CMSIS) as a vendor-independent abstraction layer for simplifying software (re-)usage. The standard enables consistent and simple software interfaces e.g. to the processor and peripherals, real-time operating systems and other middleware.
Since SEGGER is one of the CMSIS partners, embOS for Cortex-M is fully CMSIS-compliant and comes with a generic CMSIS start project that can be executed on any Cortex-M device. Further start projects for specific Cortex-M devices get shipped with embOS for Cortex-M as well (e.g. more than 170 start projects are provided with embOS for Cortex-M and Embedded Studio) and are also fully CMSIS-compliant.
With the introduction of the embOS CMSIS-Pack, CMSIS-compliant embOS projects may be created with ease for arbitrary Cortex-M devices using various IDEs.
Download
The embOS CMSIS-Pack may be obtained from SEGGER.com.
Installation
The embOS CMSIS-Pack may be used as-is: it does not need to be extracted before installing it in any CMSIS-Pack capable IDE.
The following example installation is done using IAR Embedded Workbench, but should be similar for other IDEs:
- Open the CMSIS-Pack Manager via Project -> CMSIS-Pack Manager
- Inside the CMSIS-Pack Manager, select CMSIS-Manager -> Import existing packs
- Import SEGGER.CMSIS-embOS.x.y.z.pack (e.g. SEGGER.CMSIS-embOS.1.0.1.pack)
This will extract the pack to your local IAR CMSIS-Pack repository and make it available in the IAR CMSIS-Manager as shown below:
Usage
After successful installation, the embOS CMSIS-Pack can be used to generate example projects with embOS.
Here, a project for a generic Cortex-M3 is created, but the same steps should be applied when creating a project for any specific device.
Select the required components in the CMSIS Manager:
- CMSIS
- Core
- Device
- Startup
- RTOS
- embOS API configuration
- CMSIS-RTOS (allows usage of embOS native API and CMSIS-RTOS (v1) API)
- CMSIS-RTOS2 (allows usage of embOS native API and CMSIS-RTOS (v2) API)
- Native (allows usage of embOS native API only)
- embOS kernel configuration
- Debug
- Debug and Profiling
- Debug and Trace
- Extreme Release
- Release
- Stack check
- Stack check and Profiling
- embOS API configuration
An optional embOS sample application may be added as well.
We recommend adding one of these to start with, for otherwise no main() will be included in the project and it will fail to build until that main() routine is added manually:
- OS_Mutexes.c
- OS_Mutexes_CMSIS.c (may only be used when CMSIS-RTOS (v1) API was enabled)
- OS_Mutexes_CMSIS2.c (may only be used when CMSIS-RTOS (v2) API was enabled)
- OS_Start2Tasks.c
- OS_Start2Tasks_CMSIS.c (may only be used when CMSIS-RTOS (v1) API was enabled)
- OS_Start2Tasks_CMSIS2.c (may only be used when CMSIS-RTOS (v2) API was enabled)
For example, for a Debug and Profiling configuration using the native embOS API and the sample application OS_Start2Tasks.c, the components window would look as shown below:
Feel free to add further components as desired.
After saving the configuration and returning back to the IAR Embedded Workbench, the resulting project tree would resemble the following screenshot:
Compilation should complete without warning or errors and you can start debugging the sample application.
Feel free to modify it and add your own application to the project.
Trouble-shooting
Linker Symbols with arm Keil µVision
When creating projects for arm Keil µVision, manual modification may be required to the used start-up file (e.g. startup_stm32f407xx.s).
If the linker complains about the undefined symbol Stack_Mem, the Stack_Mem symbol needs to be exported by the start-up file (e.g. startup_stm32f407xx.s). Please add
EXPORT Stack_Mem
to the start-up file.
Alternatively, if another symbol pointing to the end of the stack (lowest address of the stack) is exported, OS_InitSysStackInfo.c can be modified to use this symbol instead of Stack_Mem.
If the linker complains about the undefined symbol __initial_sp, the __initial_sp symbol needs to be exported by the start-up file (e.g. startup_stm32f407xx.s). Please add
EXPORT __initial_sp
to the start-up file.
Please note, that there might be conflicts with the stack/heap set up methods and ARM compiler V6 when __initial_sp is exported and MicroLIB is not used. In this case, and if the start-up file supports the use of MicroLIB, MicroLIB can be enabled instead of exporting __initial_sp (Options for Target -> Target -> Code Generation -> Use MicroLIB).
Alternatively, if another symbol pointing to the beginning of the stack (highest address of the stack) is exported, OS_InitSysStackInfo.c can be modified to use this symbol instead of __initial_sp.
Linker Symbols with GNU toolchains
When creating projects for GNU toolchains, manual modification may be required to the used linker file (e.g. STM32F407IGHX_FLASH.ld):
If the linker cannot find __stack_start__ and/or __stack_end__, these symbols are not defined in the linker file. To resolve this, please replace
. = . + _Min_Stack_Size;
by
__stack_start__ = .; . = . + _Min_Stack_Size; __stack_end__ = .;
in the linker file.
Conflicting types for malloc() functions with GNU toolchains
When creating projects for GNU toolchains, embOS may be used with newlib standard libraries but not e.g. redlib standard libraries.
Usage of redlib will result in compiler errors as shown below:
To resolve this, please select newlib in the project options: