006 - STM Cube Package

Changelog

Version

Date

Remark

Version

Date

Remark

1.5

28.02.2022

reworked uGOAL package platform and parameter settings

1.4

17.12.2021

update with uGOAL release 2.1.1, change package original source folder name from Middleware to Middlewares

1.3

19.07.2021

update package sources GOAL and uGOAL with release 2.1.0

1.2

01.07.2021

add description for uGOAL and differences to the classic GOAL framework

1.1

15.06.2021

Update SoM sources, minor changes in package user interface, add support for IAR and Keil IDE

1.0

 15.04.2021

Initial version

Table 1: Changelog

Introduction

Scope

The SoM functionality for the application core (AC) on an STM32 is now also available as an STMCube expansion Package. This document describes the expansion Package for application projects.

The Package contains all the sources for an STM32 SoM application and many example applications for quick commissioning.

Furthermore, “Ready to Use” STM32Cube projects are prepared for the platforms:

STM32F429ZI-Nucleo, STM32F767ZI-Nucleo, NUCLEO-G474RE, NUCLEO-H743ZI, NUCLEO-G071RB

Additional IAR workbench or Keil µVision projects can create with the STMCubeMX Configuration (*.ioc).

The package can also be integrated and used for own projects with other STM32 derivatives, with little effort.

The package is available in two versions. In addition to the classic GOAL framework variant, the package is also available as a uGOAL variant. uGOAL describes a software package, which allows integration of the SoM module into applications without using a full GOAL framework platform. The differences in the integration of the two package variants are rather minor. Only important differences are shown in the following descriptions.

Package installation

  • In the STMCube-IDE you can use the menu item:

“Help->Manage Embedded Software Packages Manager” to add the package

  • Load the SoM expansion Package (file *.pack) from a known place (here “From Local” workstation folder used):

  • Alternatively in an open STMCubeMX project (file *.ioc) under “Software Packs / Manage software packs” you can also add the package

  • Accept the package License agreement:

  • The package is now installed and available in the STMCube workspace:

Use the Package

  • For a quick start import the prepared STMCube projects via Menü “File->Import->ExistingProjects”:

The default path on the worksation after the package installation is:

For GOAL package variant:

“C:\Users\user\STM32Cube\Repository\Packs\portGmbH\I-Cube-SoM\”

For uGOAL package variant:

“C:\Users\user\STM32Cube\Repository\Packs\portGmbH\I-Cube-SoM-uGOAL\”

(“user” is here a placeholder for the current workstation user)

The next screen shows all prepared platform projects from the package as already imported projects:

Screen for uGOAL package variant:

  • All platform projects have already integrated the SoM expansion Package and use this

  • You can also adjust the interface under STM32CubeMX where you can turn individual components on and off

  • The package comes with SoM core component, that are always required and a number of example/ applications. Only one example “appl /xx” component should be selected additional to the core

  • The package should now be visible under “Software pack / selected components” and you can select the components to be used in the project (here “core” for all necessary SoM “core sources” and default the “appl / 01_pnio_io_mirror” is activated as an example application)

  • The Tab “Parameter Settings” show the most used configuration of the middleware: The Heap is activated (value "1") with the corresponding buffer size. The special feature for debugging the application core is disabled (value "0")

  • the Tab “Platform Settings” shows the necessary existing and assigned interfaces for the operation of the package on an application core

  • The “Platform Settings” shown are already suitable for the STM32F429_Nucleo platform

  • The platform independent code of the middleware can be adapted to the special underlying STM32 platform via these settings

  • Now the source code can be generated via the code generator in the STMCube-IDE (menu “Project-> Generate Code”), then the code is now also generated from the SoM expansion package and “rolled out” in the project (here folder Middleware, SoM and additional the necessary HAL-Drivers)

 Screen for GOAL package variant:

 Screen for uGOAL package variant:

 

  • Then the entire project can be rebuilt "Build all"

Use the Package in new projects

Target board adaption

The adaptation to the target board used, takes place in the STMCubeMX Configuration (*.ioc) generated by STM32CubeMX. For some targets that are already supported (e.g. STM32F429ZI_nucleo), these * .ioc files are already included in the SoM expansion package. These can serve as a template for new targets or for porting to your own hardware. In the source code of the GOAL/uGOAL software no adjustments must be made except in the STM32Cube project and the “Platform Settings” from expansion package.

GOAL variant: A certain amount of memory is required to use the GOAL package on other STM32 types - at least Flash: 200 KB, RAM: 80 KB.

uGOAL variant: A certain amount of memory is required to use the uGOAL package on other STM32 types - at least Flash: 90 KB, RAM: 36 KB.

The GOAL/uGOAL porting for STM32 is based on the generated code by the *.ioc file (HAL- Layer functions).

General preparation: If you create a new STMCube project, the target specific *.ioc file must have the same name as that used eclipse project and should be in the same folder.

Follow some steps in the STMCubeMX Configuration file that must be observed. The following settings in the figures matches the target STM32F429_nucleo, STM32F767_nucleo exactly, adjust them according to your HW. For basic information on the hardware interfaces of the SoM, see also: iRJ45/SoM - User Manual

Prepare the used HW interfaces

Requirement: you have created a new STM32Cube project with the desired CPU / board type. Now, adapt the STMCubeMX Configuration (*.ioc) file.

SPI:

The SPI interface must be activated, and the pins must match the SoM shield/target board. The SPI is the interface for communication with the SoM. The interface parameters must match with him. Details are described in IRJ45/SoM User Manual.

SPI-Settings:

SPI-Pins:

Optionally SPI works with DMA: The DMA mode can be activated with compiler switch in project settings:

GOAL_PLAT_DRV_SPI_STM32_DMA=1

 

I2C:

The I2C interface must be activated and the pins must match the SoM shield board.

 

UART:

The UART interface must be activated and the pins must match the used target board.

Additional the UART global interrupt should be enabled.

GPIO:

The following GPIO Pin labels are used in the GOAL target specific code and can be defined and adapted if necessary, via STM32Cube. Some labels are optionally. The need is different.

Label

Description

necessities

GPIO

GOAL_TARGET_LED1

User LED1 on target board

optional

PB0

GOAL_TARGET_LED2

User LED2 on target board

optional

PB7

GOAL_TARGET_LED3

User LED3 on target board

optional

PB14

GOAL_TARGET_EXT_INT

User button on target board

optional

PC13

GOAL_TARGET_SPI_CS

SPI chip selects, active low

mandatory

PD14

GOAL_TARGET_SOM_RESET

SoM external reset, active low

mandatory

PF13

Table 2: GPIO assign

Adaption in the “Platform Settings” in the STMCubeMX surface

Adapt the mandatory “Platform Settings” to the prepared HW interfaces, if necessary. The notation here is suitable for the STM32 HAL-Layer API.

Additional adaptions in the STMCube project

GOAL loop:

Add the GOAL loop function to the STM32Cube generated main loop (/Core/Src/main.c).

GOAL variant:

/* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ extern int goal_main(     int argc,                                   /**< argument count */     char **argv                                 /**< arguments */ ); /* USER CODE END 0 */ /* USER CODE BEGIN WHILE */   while (1)   {       /* call goal loop */       goal_main(0,0); /* USER CODE END WHILE */    }

uGOAL variant:

Add the uGOAL loop and some module initialization functions.

/* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "goal_includes.h" /* USER CODE END Includes */ /* USER CODE BEGIN 2 */ /* initialize uGOAL modules */ plat_init(); som_init(); appl_init(); /* USER CODE END 2 */ /* USER CODE BEGIN WHILE */   while (1)   {        /* call goal loop */       ugoal_loop(); /* USER CODE END WHILE */   }

Startup file:

Check if a suitable target startup file in the STM32Cube generated Core folder is available. Sometimes the file is missing in STM32Cube code generator projects.

e.g.

Ready to start

  • Then the entire project can be rebuilt "Build all"

  • If compilation was successful, the resulting binary now can be started (requires SoM Hardware)

Additional IAR and Keil support

With the stand-alone ST tool STM32CubeMX and an open configuration project (* .ioc) that uses the SoM STMCube package, you also have the option of creating a project for IAR workbench or a Keil µVision toolchain. Set in the “Project Manager” the desired Toolchain/IDE and press “GENERATE CODE”.

Screen here for IAR workbench (EWARM):

After the code has been generated, the IDE project can be opened with the corresponding toolchain. The code for the SoM STMCube package is then already integrated. The created project is ready to be built.