GOAL
Learn how to import CMSIS packs into existing projects. In this particular project, CMSIS packs from Crank will be used alongside the freertos_hello example obtained from the MIMXRT1060-EVKB SDK.
Note: This walkthrough was adapted from Crank Software's guide included with their CMSIS Pack.
ENVIRONMENT
This guide requires MCUXpresso IDE v11.9.1 or latest. MIMXRT1060-EVK SDK version 2.16 or latest.
PROCEDURE
1. Import the freertos_hello example into the workspace. Be sure to set the library type to Newlib (semihost).
2. Rename the project to freertos_sbengine.
3. Add drivers to the project. Right click on the project and select SDK Management -> Manage SDK Components.
NOTE: Select Keep Existing and do not replace the FreeRTOSConfig.h file when prompted after adding the following components:
4. Add additional components to the project.
Navigate to components/gt911:
Copy the fsl_gt911.c and fsl_gt911.h into the touchpanel directory in the project:
Remove the heap_4.c from the project folder. This is found in freertos/freertos-kernel/portable/MemMang.
Add the heap_3.c into the project folder freertos/FreeRTOS/portable/MemMang. This file can be found in the MIMXRT1060-EVKB SDK.
5. Download the Crank Software pack from Arm Keil | CMSIS Packs.
For this walkthrough, we will add all the components except the Runtime Source component. This component is intended for custom changes.
To add the components, right click on the project and select SDK Management -> Add Open-CMSIS Components:
Once the components are selected press Ctrl + s to save the components in the project.
8. Resolve conflicts from the previous freertos_hello project configuration.
To do this, right click on the project and select Properties. Remove all of the items found under C/C++ Build -> Settings -> Miscellaneous -> Other Objects.
Linker script = MIMXRT1062xxxxx_flexspi_nor.ld
Script path=
${cmsis_pack_root}/CrankSoftware/iMXRT10xx/8.1.0/configuration/rt1060/
Note: The path will vary depending on where the user saved the pack.
The project source folder should now look like this:
9. Configure and export a Model C/C++ Header from Storyboard Designer. Create a new project and name it sbengine_model.
Note: For more information about exporting models from Storyboard Designer visit:
Crank Storyboard - Exporting and Running on your Embedded Target.
10. Integrating the Storyboard Engine requires modifications to the following:
Locate this file in the source folder of the project and make the following changes:
#define configFRTOS_MEMORY_SCHEME 4
#define configUSE_TIME_SLICING 0
#define configENABLE_BACKWARD_COMPATIBILITY 0
#define configTICK_RATE_HZ ((TickType_t)200)
#define configUSE_NEWLIB_REENTRANT 0
To this:
#define configFRTOS_MEMORY_SCHEME 3
#define configUSE_TIME_SLICING 1
#define configENABLE_BACKWARD_COMPATIBILITY 1
#define configTICK_RATE_HZ ((TickType_t)1000)
#define configUSE_NEWLIB_REENTRANT 1
Right click on the project and select Properties -> C/C++ Build -> Settings -> MCU C Compiler. Add the following defines to the “Defined symbols (-D)” pane:
SKIP_SYSCLK_INIT
XIP_BOOT_HEADER_DCD_ENABLE=1
GRE_TARGET_OS_freertos
GRE_TARGET_CPU_cortexm7
GRE_TARGET_TOOLCHAIN_mcuxpresso
GRE_FEATURE_VFS_RESOURCES
Change the SDK_DEBUGCONSOLE define from:
SDK_DEBUGCONSOLE=0
to
SDK_DEBUGCONSOLE=1
If you are using the gt911 touch driver, you will also need to add the following preprocessor define:
SDK_I2C_BASED_COMPONENT_USED=1
Right click on the project and select Properties -> C/C++ Build -> Settings -> MCU Linker -> Libraries.
"${cmsis_pack_root}/CrankSoftware/iMXRT10xx/8.1.0/storyboard/runtime/freertos-mcuxpresso-cortexm7-swrender-DFP-obj/lib"
"${cmsis_pack_root}/CrankSoftware/iMXRT10xx/8.1.0/storyboard/runtime/freertos-mcuxpresso-cortexm7-swrender-DFP-obj/plugins”
Note: The path will vary depending on where the user saved the pack.
gre
greal
sbimage
sbvfs
gre-plugin-animation
gre-plugin-lua
gre-plugin-poly
gre-plugin-circle
gre-plugin-timer
gre-plugin-logger
gre-plugin-screen-path
gre-plugin-greio
gre-plugin-sbimage-soil
gre-plugin-fio_vfs
render-plugin-swrender
logging-util
greio
sblua
soil
swrmgr
swrender
font-plugin-freetype
sbfreetype
sbpng
sbz
Note: The library order matters. Add the libraries in the order listed above and click Apply and Close
11. Recall that this project was originally the freertos_hello example from the SDK. Therefore, modifications need to be made to the freertos_hello.c file to support the changes for this application.
#include "board.h"
#include "peripherals.h"
void sbengine_main_task(void *argument);
void sbengine_input_task(void *argument);
BOARD_InitSemcPins()
BOARD_InitBootPeripherals().
if (xTaskCreate(hello_task, "Hello_task", configMINIMAL_STACK_SIZE + 10,
NULL, hello_task_PRIORITY, NULL) != pdPASS)
with:
if (xTaskCreate(sbengine_main_task, "sbengine", 8192, NULL,
configMAX_PRIORITIES / 2, NULL) != pdPASS)
if (xTaskCreate(sbengine_input_task, "StoryboardInput", 2048, NULL,
configMAX_PRIORITIES / 2, NULL) != pdPASS)
{
PRINTF("Task creation failed!.\r\n");
while (1);
}
The source code should now look like this:
/* FreeRTOS kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "timers.h"
/* Freescale includes. */
#include "fsl_device_registers.h"
#include "fsl_debug_console.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#include "peripherals.h"
/*******************************************************************************
* Definitions
******************************************************************************/
void sbengine_main_task(void *argument);
void sbengine_input_task(void *argument);
/*******************************************************************************
* Code
******************************************************************************/
/*!
* @brief Application entry point.
*/
int main(void)
{
/* Init board hardware. */
BOARD_ConfigMPU();
BOARD_InitBootPins();
BOARD_InitSemcPins();
BOARD_InitBootPeripherals();
BOARD_InitBootClocks();
BOARD_InitDebugConsole();
if (xTaskCreate(sbengine_main_task, "sbengine", 8192, NULL,
configMAX_PRIORITIES / 2, NULL) != pdPASS)
{
PRINTF("Task creation failed!.\r\n");
while (1)
;
}
if(xTaskCreate(sbengine_input_task, "StoryboardInput", 2048, NULL, configMAX_PRIORITIES / 2, NULL) != pdPASS)
{
PRINTF("Task creation failed!.\r\n");
while(1);
}
vTaskStartScheduler();
for (;;)
;
}
NOTE: Check that the line: #include sbengine_model.h in the sbengine_task_pxp.c file matches the name of the exported header file from Storyboard.
The project should now build: