ST STM32F3

From SEGGER Wiki
(Redirected from Tracing on ST STM32F303)
Jump to: navigation, search

This article describes device specifics of the ST STM32F3 series devices. The STM32F3 devices are Cortex-M4 based MCUs with low-power functionality.

Internal Flash

The following flash regions are supported by J-Link.

Device Range Total size
STM32F3xxx4 0x0800_0000 - 0x0800_3FFF 16 KB
STM32F3xxx6 0x0800_0000 - 0x0800_7FFF 32 KB
STM32F3xxx8 0x0800_0000 - 0x0800_FFFF 64 KB
STM32F3xxxB 0x0800_0000 - 0x0801_FFFF 128 KB
STM32F3xxxC 0x0800_0000 - 0x0803_FFFF 256 KB
STM32F3xxxE 0x0800_0000 - 0x0807_FFFF 512 KB
All (opt. bytes) 0x1FFF_F800 - 0x1FFF_F80F 12 (16 for B/C/E)

Reset

For the STM32F3 devices, the Cortex-M default reset strategy is used.

Debug specific

Please refer to the general STM32 article

Option Byte Programming in J-Flash

J-Flash supports programming of the option bytes for STM32F3 devices. In order to program the option bytes simply choose the appropriate Device, which allows option byte programming, in the CPU settings tab (e.g. STM32F302RE (allow opt. bytes)). J-Flash will allow programming a virtual 16-byte sector at address 0x06000000 which represents the 8 option bytes and their complements. You do not have to care about the option bytes complements since they are calculated automatically. The following table describes the structure of the option bytes sector:

Address [31:24] [23:16] [15:08] [07:00]
0x06000000 complement Option byte 1 complement Option byte 0
0x06000004 complement Option byte 3 complement Option byte 2
0x06000008 complement Option byte 5 complement Option byte 4
0x0600000C complement Option byte 7 complement Option byte 6
Note:
  • Writing a value of 0xFF inside option byte 0 will read-protect the STM32F3. In order to keep the device unprotected you have to write the key value 0xAA into option byte 0.
  • The address 0x06000000 is a virtual address only. The option bytes are originally located at address 0x1FFFF800. The remap from 0x06000000 to 0x1FFFF800 is done automatically by J-Flash.

Example

To program the option bytes 2 and 3 with the values 0xAA and 0xBB, but leave the device unprotected your option byte sector (at addr 0x06000000) should look like as follows:

Address [31:24] [23:16] [15:08] [07:00]
0x06000000 0x00 0xFF 0x55 0xAA
0x06000004 0x44 0xBB 0x55 0xAA
0x06000008 0x00 0xFF 0x00 0xFF
0x0600000C 0x00 0xFF 0x00 0xFF

For a detailed description of each option byte, please refer to the ST reference manual related to the device.

Securing/unsecuring the device

Please refer to the generic wiki-article: STM32#MCU_Security

Tracing

This section describes how to get started with trace on the ST STM32F303 MCU. This section assumes that there is already a basic knowledge about trace in general (what is trace, what different implementations of trace are there, etc.). If this is not the case, we recommend to read Trace chapter in the J-Link User Manual (UM08001). The ST STM32F303 MCU implements tracing via pins, so a J-Trace can be used for tracing.

Minimum requirements

In order to use trace on the ST STM32F303 devices, the following minimum requirements have to be met:

  • J-Link software version V6.30h or later
  • Ozone V2.56e or later (if streaming trace and / or the sample project from below shall be used)
  • J-Trace PRO for Cortex-M HW version V1.0 or later

To rebuild the project our IDE Embedded Studio can be used. The recommended version to rebuild the projects is V6.30. But the examples are all prebuild and work out-of-the box with Ozone, so rebuilding is not necessary.

Sample project

Streaming trace

The following sample project is designed to be used with J-Trace PRO and Ozone to demonstrate streaming trace. The project has been tested with the minimum requirements mentioned above and a STM3303C-EVAL Rev.C Evalboard. The sample project comes with a pre-configured project file for Ozone that runs out-of-the box. In order to rebuild the sample project, SEGGER Embedded Studio can be used.

ST_STM32F303_EVAL_Trace_Example.zip

Note:

The example is shipped with a compiled .JLinkScriptfile, should you need the original source, please get in touch with SEGGER directly via our support system: https://www.segger.com/ticket/.

To create your own .JLinkScriptfile you can use the following guide as reference: How_to_configure_JLinkScript_files_to_enable_tracing

Tested Hardware

STM3303F-EVAL Rev.C

RTT

SEGGER's RTT can be used with a J-Link connected to a STM32F3 target device.

Sample project

For a sample Embedded Studio project, refer to the following .zip archive:
ST_STM32F303_NUCLEO_RTT.zip

Note:

The above project was tested with the following setup:

Target device STM32F303RE
Evalboard NUCLEO-F303RE (ST)
J-Link software version V6.51b
Embedded Studio version V4.18

Tested Hardware

NUCLEO-F303RE Rev. C