Skip to content

Commit f505eec

Browse files
committed
8.0.0
1 parent 072f349 commit f505eec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+29472
-74
lines changed

arm-cm/dpp_nucleo-l053r8/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14")
6464
set_property(TARGET ${TGT} PROPERTY POSITION_INDEPENDENT_CODE FALSE)
6565
endif()
6666

67+
# set the qpc include path to find our local `qp_config.h´
68+
set(QPC_CFG_QPCONFIG_H_INCLUDE_PATH ${CMAKE_CURRENT_LIST_DIR})
6769
# add the qpc library to the project
6870
qpc_sdk_init()
6971

arm-cm/dpp_nucleo-u545re/qk/armclang/dpp-qk.uvoptx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<OPTFL>
7676
<tvExp>1</tvExp>
7777
<tvExpOptDlg>0</tvExpOptDlg>
78-
<IsCurrentTarget>1</IsCurrentTarget>
78+
<IsCurrentTarget>0</IsCurrentTarget>
7979
</OPTFL>
8080
<CpuCode>18</CpuCode>
8181
<DebugOpt>
@@ -300,7 +300,7 @@
300300
<OPTFL>
301301
<tvExp>1</tvExp>
302302
<tvExpOptDlg>0</tvExpOptDlg>
303-
<IsCurrentTarget>0</IsCurrentTarget>
303+
<IsCurrentTarget>1</IsCurrentTarget>
304304
</OPTFL>
305305
<CpuCode>18</CpuCode>
306306
<DebugOpt>
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
/*
2+
* FreeRTOS V202212.01
3+
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
* this software and associated documentation files (the "Software"), to deal in
7+
* the Software without restriction, including without limitation the rights to
8+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
* the Software, and to permit persons to whom the Software is furnished to do so,
10+
* subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
* https://www.FreeRTOS.org
23+
* https://github.com/FreeRTOS
24+
*
25+
*/
26+
27+
/******************************************************************************
28+
See http://www.freertos.org/a00110.html for an explanation of the
29+
definitions contained in this file.
30+
******************************************************************************/
31+
32+
#ifndef FREERTOS_CONFIG_H
33+
#define FREERTOS_CONFIG_H
34+
35+
/*-----------------------------------------------------------
36+
* Application specific definitions.
37+
*
38+
* These definitions should be adjusted for your particular hardware and
39+
* application requirements.
40+
*
41+
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
42+
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
43+
* https://www.FreeRTOS.org/a00110.html
44+
*----------------------------------------------------------*/
45+
#ifndef __IASMARM__
46+
extern uint32_t SystemCoreClock;
47+
#endif
48+
49+
/* Cortex M33 port configuration. */
50+
#define configENABLE_MPU 0
51+
#define configENABLE_FPU 1
52+
#define configENABLE_TRUSTZONE 0
53+
54+
/* This part has 8 MPU regions. */
55+
#define configTOTAL_MPU_REGIONS 8
56+
57+
/* Run FreeRTOS on the secure side and never jump to the non-secure side. */
58+
#define configRUN_FREERTOS_SECURE_ONLY 1
59+
60+
/* Constants related to the behaviour or the scheduler. */
61+
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
62+
#define configUSE_PREEMPTION 1
63+
#define configUSE_TIME_SLICING 0
64+
#define configMAX_PRIORITIES ( 32U )
65+
#define configIDLE_SHOULD_YIELD 0
66+
#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */
67+
68+
/* Constants that describe the hardware and memory usage. */
69+
#define configCPU_CLOCK_HZ SystemCoreClock
70+
#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 256 )
71+
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
72+
#define configMAX_TASK_NAME_LEN ( 12 )
73+
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50 * 1024 ) )
74+
75+
/* Constants that build features in or out. */
76+
#define configUSE_MUTEXES 1
77+
#define configUSE_TICKLESS_IDLE 0
78+
#define configUSE_APPLICATION_TASK_TAG 0
79+
#define configUSE_NEWLIB_REENTRANT 0
80+
#define configUSE_COUNTING_SEMAPHORES 1
81+
#define configUSE_RECURSIVE_MUTEXES 1
82+
#define configUSE_QUEUE_SETS 0
83+
#define configUSE_TASK_NOTIFICATIONS 0
84+
#define configUSE_TRACE_FACILITY 0
85+
86+
/* Constants that define which hook (callback) functions should be used. */
87+
#define configUSE_IDLE_HOOK 1
88+
#define configUSE_TICK_HOOK 1
89+
#define configUSE_MALLOC_FAILED_HOOK 0
90+
91+
/* Constants provided for debugging and optimisation assistance. */
92+
#define configCHECK_FOR_STACK_OVERFLOW 2
93+
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
94+
#define configQUEUE_REGISTRY_SIZE 0
95+
96+
/* Software timer definitions. */
97+
#define configUSE_TIMERS 0
98+
#define configTIMER_TASK_PRIORITY ( 3 )
99+
#define configTIMER_QUEUE_LENGTH 5
100+
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
101+
102+
/* Set the following definitions to 1 to include the API function, or zero
103+
* to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is
104+
* only necessary if the linker does not automatically remove functions that are
105+
* not referenced anyway. */
106+
#define INCLUDE_vTaskPrioritySet 1
107+
#define INCLUDE_uxTaskPriorityGet 1
108+
#define INCLUDE_vTaskDelete 0
109+
#define INCLUDE_vTaskCleanUpResources 0
110+
#define INCLUDE_vTaskSuspend 1
111+
#define INCLUDE_vTaskDelayUntil 1
112+
#define INCLUDE_vTaskDelay 1
113+
#define INCLUDE_uxTaskGetStackHighWaterMark 0
114+
#define INCLUDE_xTaskGetIdleTaskHandle 0
115+
#define INCLUDE_eTaskGetState 1
116+
#define INCLUDE_xTaskResumeFromISR 0
117+
#define INCLUDE_xTaskGetCurrentTaskHandle 1
118+
#define INCLUDE_xTaskGetSchedulerState 0
119+
#define INCLUDE_xSemaphoreGetMutexHolder 0
120+
#define INCLUDE_xTimerPendFunctionCall 1
121+
122+
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
123+
124+
/* Dimensions a buffer that can be used by the FreeRTOS+CLI command interpreter.
125+
* See the FreeRTOS+CLI documentation for more information:
126+
* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_CLI/ */
127+
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
128+
129+
/* Interrupt priority configuration follows...................... */
130+
131+
/* Use the system definition, if there is one. */
132+
#ifdef __NVIC_PRIO_BITS
133+
#define configPRIO_BITS __NVIC_PRIO_BITS
134+
#else
135+
#define configPRIO_BITS 4 /* 15 priority levels. */
136+
#endif
137+
138+
/* The lowest interrupt priority that can be used in a call to a "set priority"
139+
* function. */
140+
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
141+
142+
/* The highest interrupt priority that can be used by any interrupt service
143+
* routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT
144+
* CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
145+
* HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values). */
146+
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 4
147+
148+
/* Interrupt priorities used by the kernel port layer itself. These are generic
149+
* to all Cortex-M ports, and do not rely on any particular library functions. */
150+
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
151+
152+
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
153+
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
154+
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
155+
156+
/* Constants related to the generation of run time stats. */
157+
#define configGENERATE_RUN_TIME_STATS 0
158+
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
159+
#define portGET_RUN_TIME_COUNTER_VALUE() 0
160+
#define configTICK_RATE_HZ ( ( TickType_t ) 100 )
161+
162+
/* Enable static allocation. */
163+
#define configSUPPORT_STATIC_ALLOCATION 1
164+
#define configSUPPORT_DYNAMIC_ALLOCATION 0
165+
166+
#endif /* FREERTOS_CONFIG_H */
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
> **NOTE**
2+
This file is best viewed in a **markdown viewer**, such as the one built into GitHub. Markdown viewers are also available as plug-ins to popular Internet browsers.
3+
4+
# DPP on NUCLEO-U545RE
5+
This example demonstrates QP port to the FreeRTOS on the STM32 NUCLEO-U545RE board (ARM Cortex-M33).
6+
7+
<p align="center">
8+
<img src="logo_freertos.webp"/>
9+
</p>
10+
11+
The example uses the [Dining Philosophers Problem (DPP) application](https://www.state-machine.com/qpc/tut_dpp.html)
12+
13+
<p align="center">
14+
<img src="stm32-nucleo-u545re.webp"/><br>
15+
<b>STM32 NUCLEO-U545RE</b>
16+
</p>
17+
18+
## Features Demonstrated
19+
- QP port to FreeRTOS
20+
+ with GNU-ARM toolchain
21+
+ with Keil-MDK toolchain
22+
+ with IAR-ARM toolchain
23+
- multiple cooperating active objects
24+
- immutable (const) events
25+
- mutable (dynamic) events
26+
- time events
27+
- direct event posting
28+
- publish-subscribe event delivery
29+
30+
31+
## Build Configurations
32+
- Debug
33+
- Release
34+
- Spy - software tracing with the built-in virtual COM port
35+
36+
# Code Organization
37+
```
38+
examples\freertos\dpp_nucleo-u545re
39+
|
40+
| +---armclang // Keil-MDK toolchain
41+
| | dpp.uvprojx // Keil uVision project
42+
| +---gnu // GNU-ARM toolchain
43+
| | Makefile // Makefile for GNU-ARM
44+
| \---iar // IAR EWARM
45+
| dpp-qk.eww // IAR EW-ARM workspace
46+
```
47+
48+
# Building the example
49+
50+
### GNU/ARM
51+
- open terminal window
52+
- change to the `gnu` sub-directory
53+
- to build the default Debug configuration, type:
54+
55+
```
56+
make
57+
```
58+
59+
> **NOTE**
60+
The `make` utility for Windows is provided in the QTools collection for Windows.
61+
62+
- to build the Release configuration, type:
63+
64+
```
65+
make CONF=rel
66+
```
67+
68+
- to build the Spy configuration, type:
69+
70+
```
71+
make CONF=spy
72+
```
73+
74+
### ARM/KEIL MDK
75+
- Open the provided KEIL uVision project (`armclang\dpp.uvprojx`)
76+
in Keil uVision IDE. Build/Debug/Download to the board from the IDE.
77+
- Change the build configuration in the "Project Target" drop-down menu.
78+
79+
80+
### IAR EWARM
81+
- Open the provided IAR EWARM workspace (`iar\dpp.eww`)
82+
in IAR EWARM IDE. Build/Debug/Download to the board from the IDE.
83+
- Change the build configuration in the "Project Configuration" drop-down menu.
84+
85+
86+
# Uploading the Binary to the Board
87+
The STM32 NUCLEO boards enumerate as a USB drive when connected to the host computer. The boards then can be programmed by **copying** the binary to that USB drive. This can be useful for the command-line GNU/ARM build. For example, to program the binary produced for the Debug configuration, you can type:
88+
89+
```
90+
copy dbg\dpp.bin E:
91+
```
92+
NOTE: The above command assumes that the NUCLEO board enumerated as drive E:. Of course you need to adjust the command for your specific drive letter.
93+
94+
Alternatively, if you use IDEs, such as KEIL-MDK or IAR EWARM, you can program the board from the IDE (e.g., by starting a debug session).
95+
96+
97+
# Tracing with QP/Spy
98+
When the board is flashed with the Spy build configuration, it produces the QP/Spy software tracing output to the built-in virtual COM port of the TivaC LauchPad board. The trace is binary rather than ASCII, and therefore requires a special host-based application called QSPY.
99+
100+
> **NOTE** QSPY host application is available in the QTools collection.
101+
102+
To launch the QSPY host application:
103+
- open terminal window
104+
- type:
105+
106+
```
107+
qspy -c COM5
108+
```
109+
110+
where "COM5" is an example virtual COM port enumerated by the board. You need to check the specific COM port number on your host computer using the Device Manager application, Ports (COM and LPT) section.
111+
112+
113+
The following screen shot shows a typical output from QSPY:
114+
115+
<p align="center">
116+
<img src="./qspy-output.png"/><br>
117+
<b>Typical QSPY output produced by the Spy build configuration</b>
118+
</p>
119+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; *************************************************************
2+
; *** Scatter-Loading Description File generated by uVision ***
3+
;
4+
; Adapted by Quantum Leaps:
5+
; added STACK as the first section in RW_STACK
6+
; *************************************************************
7+
8+
LR_IROM1 0x08000000 0x00080000 { ; load region size_region
9+
ER_IROM1 0x08000000 0x00080000 { ; load address = execution address
10+
*.o (RESET, +First)
11+
*(InRoot$$Sections)
12+
.ANY (+RO)
13+
.ANY (+XO)
14+
}
15+
RW_IRAM1 0x20000000 0x00040000 { ; RW data
16+
.ANY (+RW +ZI)
17+
}
18+
19+
RW_STACK 0x28000000 { ; STACK area
20+
* (STACK, +First)
21+
}
22+
RW_IRAM2 +0 (0x00004000 - 2048) {
23+
.ANY (+RW +ZI)
24+
}
25+
}
26+

0 commit comments

Comments
 (0)