Example: barber

Programming External Flash with STM32 Devices - Keil

AN333 Programming External Flash used with STM32 Devices Copyright 2020 Arm Ltd. All rights reserved 1 Programming External Flash used with STM32 Devices MDK Tutorial AN333, Autumn 2020, Abstract This application note shows a universal approach for Programming External Flash memory connected to an STM32 microcontroller device with Keil MDK. An example is presented using the STM32F769I-Discovery board with an STM32F769 NIH6 microcontroller and MX25L51245G NOR Flash connected over quad-SPI. However, the demonstrated concepts can be similarly applied to other STM32 Devices and Flash memories. Contents Abstract ..1 Prerequisites ..1 Introduction.

Some STM32 DFPs also contain FLM files that implement flash programming algorithms for external flash devices located on specific development boards such as “Discovery” or “Eval”. However, the provided flash

Tags:

  Programming, Board, External, Flash, Stm32, Programming external flash

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Programming External Flash with STM32 Devices - Keil

1 AN333 Programming External Flash used with STM32 Devices Copyright 2020 Arm Ltd. All rights reserved 1 Programming External Flash used with STM32 Devices MDK Tutorial AN333, Autumn 2020, Abstract This application note shows a universal approach for Programming External Flash memory connected to an STM32 microcontroller device with Keil MDK. An example is presented using the STM32F769I-Discovery board with an STM32F769 NIH6 microcontroller and MX25L51245G NOR Flash connected over quad-SPI. However, the demonstrated concepts can be similarly applied to other STM32 Devices and Flash memories. Contents Abstract ..1 Prerequisites ..1 Introduction.

2 2 Flash Programming in Keil MDK ..2 Create a Flash Programming algorithm ..3 Debug a Flash Programming Access data and execute code from External Flash .. 11 Memory mapping via scatter file .. 15 Program External Flash memory .. 16 Summary .. 17 References and Useful Links .. 17 Prerequisites To reproduce the example described in this application note the following components are required: Components from Arm: Arm Keil MDK: IDE and debugger used for project development and debug. To create a Flash Programming algorithm, an MDK-Essential license or above is required. MDK is used here. ARM::CMSIS: CMSIS pack. Version is used to create the example. Keil::STM32F7xx_DFP: Device Family Pack (DFP) for STM32F7 Devices .

3 Among other items, contains startup and system files as well as example applications. Version is used. Components from ST: STM32F769I-Discovery Kit: target hardware used in the example. STM32 CubeMX: a graphical tool that allows easy configuration of STM32 microcontrollers. Version with MCU Package for STM32F7 v is used. Example project A ZIP file is available for download at It contains projects implementing Flash Programming algorithms for several STM32 Discovery boards, as well as Blinky examples showing how to use them in a project. AN333 Programming External Flash used with STM32 Devices Copyright 2020 Arm Ltd. All rights reserved 2 Introduction In most cases, on-chip Flash memory available on STM32 device is sufficient to run a user application.

4 Loading the program into the device is done using the provided Flash Programming algorithms. However, in cases when the size of the on-chip Flash is not sufficient it may be required to use an External Flash to either store constant data on it or to execute the program from it. For example, this can be the case in an embedded system with a display where high-quality graphic content requiring a lot of memory can be kept in External Flash . The process can be split into several distinctive parts explained in corresponding chapters in this document: Create a Flash Programming algorithm: explains how to create a special program that can write the required data to the External Flash device. Debug a Flash Programming algorithm: provides instructions how to set up a project that allows to debug the Flash Programming algorithm.

5 Access data and execute code from External Flash : gives an example of a program that uses External Flash for storing data and program code. Program External Flash : shows how to use the Programming algorithm in Keil MDK. Flash Programming in Keil MDK In order to program on-chip or External Flash , Keil MDK relies on Flash Programming algorithms a special piece of software that the tool temporarily places into the MCU s RAM and then uses its interface to supply the data and store it in the target Flash memory. The Flash algorithms for Keil MDK have the extension FLM. The Figure below explains the Flash Programming concept in Keil MDK. During device Programming in the Vision IDE, first the Flash Programming algorithm for the target ROM area (in form of an FLM file) gets placed into the microcontroller s RAM.

6 After that, using the Programming algorithm API, the firmware image file gets written into the corresponding Flash memory this can be on-chip Flash , or an External Flash device. Application Note 334: MDK Flash Download explains in detail how Flash algorithms are used in MDK to erase, download, and verify the application in the Flash memory. For the target microcontroller, the algorithms for on-chip Flash are typically included in the corresponding Device Family Pack (DFP) and require no modifications from the user. This is also the case for STM32 Devices . Example applications provided in the DFP are already configured to use these algorithms for internal Flash . AN333 Programming External Flash used with STM32 Devices Copyright 2020 Arm Ltd.

7 All rights reserved 3 Some STM32 DFPs also contain FLM files that implement Flash Programming algorithms for External Flash Devices located on specific development boards such as Discovery or Eval . However, the provided Flash algorithm files will not work on a custom PCB with another device variant and different pinout. For such custom cases, users need to create a Flash algorithm as explained in the next chapter. Create a Flash Programming algorithm This chapter explains the steps required for creating a custom Flash Programming algorithm that will be able to load a program to an External Flash device connected to a target STM32 MCU. Note: Creating a Flash Programming algorithm with MDK-Lite is not supported.

8 1. Copy the _Template_Flash\ folder from the ARM:CMSIS Pack folder (available by default in C:\Users\<userName>\Pack\ARM\CMSIS\<version>\Device\_Template_Flash) to a new folder. This is a template project for Flash Programming algorithms. It is used as the basis for implementing the Flash Programming algorithm for the target system. 2. Remove the read-only protection for the copied directory including all subdirectories and files in it. 3. Rename the folder to reflect the purpose. In our example it is STM32F769I_Discovery_QPSI_MX25L51245G. 4. Rename the project file to represent the new Flash ROM device name. In our example it is renamed to 5. Open the project file with Vision. 6. Go to Project Options for Target (Alt+F7): On the Target tab, select the target microcontroller device.

9 In our example it is STM32F769 NIHx. Note: The dialog displays only Devices supported by already installed DFPs. If the target device is not available, you need to install its DFP using the Pack Installer tool. Verify that in the Code Generation area ARM Compiler field selects Use default compiler version 6. On the Output tab: o Change the content of the field Name of Executable to represent the target device and Flash . The name shall not exceed 31 characters as otherwise the file will not be detected by Vision IDE. In our example it is set to STM32F769I_Disco_MX25L51245G. o Verify that Debug Information flag is set. This is needed to ensure that Vision can call individual functions from the resulting FLM file.

10 Press OK. 7. Open the Manage Run-Time Environment window: Enable the CMSIS:CORE component. Enable the Device:Startup component. Enable the Device: STM32 Cube Framework(API): STM32 CubeMX component. Start STM32 CubeMX by clicking the button next to it. AN333 Programming External Flash used with STM32 Devices Copyright 2020 Arm Ltd. All rights reserved 4 8. In STM32 CubeMX, follow these steps to configure the MCU connection to the External Flash and generate the corresponding code: On the Pinout & Configuration tab: o In the Categories view expand the Connectivity category and select QUADSPI as this is the interface used on the board in our example. This opens QUADSPI Mode and Configuration o Select the proper QuadSPI Mode (in our example Bank1 with Quad SPI Lines) o In the Configuration section on the Parameter Settings tab, set the correct parameters according to the target setup.


Related search queries