[LINUX] Build and run TOPPERS / ASP (2020-03-10 version)

Introduction

Previously, " Build and run TOPPERS / ASP ", " Build and run TOPPERS / ASP3 " I posted an article about TOPPERS / ASP, but ** dated March 10, 2020 * I found an article that the dependent packages for ARM Cortex-M4 and ARM Cortex-M7 have been upgraded, so I used this new version of the source code to ** build ** and ** run * again. I decided to try *.

・ TOPPERS homepage  https://www.toppers.jp/

-ASP 1.9.6 ARM Cortex-M4 architecture-GCC dependent package  https://www.toppers.jp/asp-d-download.html#arm_m4

-ASP 1.9.5 ARM Cortex-M7 architecture-GCC dependent package  https://www.toppers.jp/asp-d-download.html#arm_m7

In the Qiita articles so far, only the code for the microcomputer board ** NUCLEO-F401RE ** released by ** STMicroelectronics ** (hereinafter, ** STMicro **) with ARM Cortex-M4 as the core I was building and running, but this time I built and operated the code for the following 4 boards including the board with ** Cortex-M7 ** as the core.

・ NUCLEO-F401RE ・ NUCLEO-F446RE ・ NUCLEO-G474RE ・ STM32F7-DISCOVERY

By the way, "NUCLEO-G474RE" is a board added in this version upgrade of "ARM Cortex-M4 architecture".

gra_f401_1.jpggra_f446_1.jpg gra_g474_1.jpggra_f7disc1.jpg

What is TOPPERS / ASP?

As mentioned in the previous Qiita article, I will briefly introduce it here as well. ** TOPPERS / ASP ** is the TOPPERS project (TOPPERS: ** T ** oyohashi ** OP ** en ** P ** platform for ** E ** mbedded ** R ** eal-time ** S ** ystems) is one of the ITRON-specification RTOS managed and published. TOPPERS An RTOS that can be run on a one-chip microcomputer as a new-generation kernel. Please refer to the following page for details such as functions.

・ TOPPERS / ASP kernel page  https://www.toppers.jp/asp-kernel.html

About the build environment

In this build environment, as in the previous Qiita article, we will install a toolchain such as a cross compiler for Arm Cortex-M on Linux and build source code such as TOPPERS / ASP. " Build and run TOPPERS / ASP for the location of files required for environment construction, extraction method, and precautions. It is described in "Preparation for running TOPPERS / ASP" and "Building environment", and this time TOPPERS / ASP can also be built in this environment, so Article .

TOPPERS / ASP build preparation

Once the build environment is ready, the next step is to prepare for the actual TOPPERS / ASP build.

1. 1. Get source file

When building, download the source code of the target-independent part of TOPPERS / ASP and the target-dependent part of Cortex-M4 and Cortex-M7, which are the targets of this time, from the following.

・ Target-independent part  https://www.toppers.jp/download.cgi/asp-1.9.3.tar.gz

・ Target-dependent part  https://www.toppers.jp/download.cgi/asp_arch_arm_m4_gcc-1.9.6.tar.gz  https://www.toppers.jp/download.cgi/asp_arch_arm_m7_gcc-1.9.5.tar.gz

In addition to the TOPPERS / ASP source code, download the configurator required for the build.

-Configurator Release 1.9.6  https://www.toppers.jp/download.cgi/cfg-1.9.6.tar.gz

2. Build configuration tool

Extract ** cfg-1.9.6.tar.gz ** to any directory on Ubuntu. When expanded, a ** cfg ** directory will be created and files and directories will be expanded under it.

tar xzf cfg-1.9.6.tar.gz
cd cfg

I want to execute **. / Configure ** here, but since the line feed code of the configure file is created with ** 0x0d 0x0a **, if I execute it as it is, the configuration will fail with an error. Therefore, the line feed code is converted to ** 0x0a ** only by the following operation.

mv configure configure.org
tr -d '\r' < configure.org > configure
chmod a+x configure

After conversion, build the configuration tool with the following command.

./configure
make

If the build is successful, the following command will be generated, but for now, proceed as it is.

./cfg/cfg ・ ・ ・ ・ * 1

3. 3. Deploying TOPPERS / ASP kernel sources

Extract the following source files for the TOPPERS / ASP kernel.  asp-1.9.3.tar.gz  asp_arch_arm_m4_gcc-1.9.6.tar.gz  asp_arch_arm_m7_gcc-1.9.5.tar.gz

cd ..
tar xzf asp-1.9.3.tar.gz
tar xzf asp_arch_arm_m4_gcc-1.9.6.tar.gz
tar xzf asp_arch_arm_m7_gcc-1.9.5.tar.gz

First, unpacking asp-1.9.3.tar.gz will unpack the TOPPERS / ASP kernel itself under the asp directory.

asp
|-- arch
|   |-- gcc
|   |-- logtrace
|   `-- m68k_gcc
|-- doc
|-- extension
|-- include
|-- kernel
|-- library
|-- pdic
|-- sample
|-- syssvc
|-- target
|   `-- dve68k_gcc
|-- test
`-- utils

Next, expand ** asp_arch_arm_m4_gcc-1.9.6.tar.gz ** and ** asp_arch_arm_m7_gcc-1.9.5.tar.gz **, respectively, and then expand the ** arch ** directory and * under the ** asp ** directory, respectively. The code for each target dependency for ** Cortex-M4 ** and ** Cortex-M7 ** is extracted to the * target ** directory.

Configuration when asp_arch_arm_m4_gcc-1.9.6.tar.gz is expanded by itself

asp
|-- arch
|   |-- arm_m_gcc
|   |   |-- common
|   |   |-- stm32f4xx
|   |   |-- stm32g4xx
|   |   |-- stm32l4xx
|   |   `-- stm32wbxx
|   `-- gcc
|-- target
|   |-- stm32e407_gcc
|   |-- stm32f401nucleo_gcc
|   |-- stm32f429board_gcc
|   |-- stm32f446nucleo144_gcc
|   |-- stm32f446nucleo64_gcc
|   |-- stm32f4discovery_gcc
|   |-- stm32g431nucleo64_gcc
|   |-- stm32g474nucleo64_gcc
|   |-- stm32l476discovery_gcc
|   |-- stm32l476nucleo64_gcc
|   |   `-- stm32l4xx
|   |-- stm32l4r5nucleo144_gcc
|   `-- stm32wb55nucleo_gcc
`-- tools
    |-- TrueSTUDIO
    |   `-- stm32f401nucleo
    `-- rommon

Configuration when asp_arch_arm_m7_gcc-1.9.5.tar.gz is expanded by itself

asp
|-- arch
|   |-- arm_m_gcc
|   |   |-- common
|   |   |-- stm32f7xx
|   |   `-- stm32h7xx
|   `-- gcc
|-- target
|   |-- stm32f723discovery_gcc
|   |-- stm32f746nucleo144_gcc
|   |-- stm32f767nucleo144_gcc
|   |-- stm32f769discovery_gcc
|   |-- stm32f7discovery_gcc
|   `-- stm32h743nucleo144_gcc
`-- tools

After unpacking, copy the ** cfg ** command created earlier * 1 to the asp / cfg / cfg directory.

mkdir -p asp/cfg/cfg
cp -a cfg/cfg/cfg asp/cfg/cfg/
asp
 |-- arch
 |-- cfg
 |   `-- cfg
 |       `--cfg ← Copy the cfg command here
 `-- doc

4. Creating a directory for building applications

Create an application directory and an application build directory. Here, the directory name is used to identify the microcomputer type as the application directory, but you can use any directory name.

mkdir -p f401/obj
mkdir -p f446/obj
mkdir -p g474/obj
mkdir -p f7disc/obj
asp
 |-- arch
 |  :
 |
 |--f401 ← Application directory
 |   `--obj ← Application build directory
 |
 |-- f446
 |   `-- obj
 |
 |-- g474
 |   `-- obj
 |
 `-- f7disc
     `-- obj

TOPPERS / ASP build execution

1. 1. TOPPERS / ASP kernel configuration

Next, move to the ** / obj ** directory of the microcomputer type to be built and configure the kernel. The meanings of the options of the configure command are as follows. -T: Target selection Specify the following character strings in each directory according to the board to be operated this time.    stm32f401nucleo_gcc    stm32f446nucleo64_gcc    stm32g474nucleo64_gcc    stm32f7discovery_gcc Others by specifying the directory name under asp / target It is possible to choose a target. -d: Selection of execution environment Allocate the code after build to the Flash memory area by specifying other than "** RAM **".

Go to each directory and run the configure command.

cd f401/obj
../../asp/configure -T stm32f401nucleo_gcc -dROM
cd ../..
cd f446/obj
../../asp/configure -T stm32f446nucleo64_gcc -dROM
cd ../..
cd f446/obj
../../asp/configure -T stm32g474nucleo64_gcc -dROM
cd ../..
cd f7disc/obj
../../asp/configure -T stm32f7discovery_gcc -dROM

2. Check and modify Makefile

If the configuration is successful, ** Makefile ** will be generated under the ** obj ** directory. Check the definitions of ** 51st line ** and ** 79th line ** of the generated ** Makefile **.

TARGET = stm32f401nucleo_gcc ← Target name specified by the configure command
DBGENV := TOPPERS_ROM

Add the definition on the line following line ** 331 ** so that the build-generated code file contains the binary file.

  $(OBJCOPY) -O srec -S $(OBJFILE) $(OBJNAME).srec
  $(OBJCOPY) -O binary -S $(OBJFILE) $(OBJNAME).bin ← added

3. 3. Build execution

Run the ** make ** command in the ** obj ** directory. If the build is successful, the files necessary for executing TOPPERS / ASP such as ** asp.bin ** will be generated.

make
$ ll asp*
-rwxrwxr-x 1 ubuntu ubuntu 301548 March 25 02:54 asp*
-rwxrwxr-x 1 ubuntu ubuntu 28600 March 25 02:54 asp.bin*
-rwxrwxr-x 1 ubuntu ubuntu 85868 March 25 02:54 asp.srec*
-rw-rw-r--1 ubuntu ubuntu 8125 March 25 02:54 asp.syms

Run on a microcomputer board

1. 1. Write to the microcomputer

Connect the microcomputer board to the PC via USB. When connected, it will be recognized as mass storage by the PC, and you can copy files with Explorer. Next, copy the ** asp.bin ** file generated by the build on Ubuntu to the microcomputer board via Explorer. When the copy is completed, writing to the board is completed.

2. Execute

After installing the STMicro driver, the USB on each microcontroller board will also be recognized as a virtual COM port. When you start serial terminal software such as TeraTerm and connect the COM port of each microcomputer board with ** 115200bps **, the log information output by the TOPPERS / ASP kernel is displayed on the serial terminal software, and the TOPPERS / ASP kernel and sample program. You can see that is working. Since all the same sample programs are running this time, the display is almost the same, but since the target, microcomputer core name, and build date and time are output on the first line immediately after startup, different boards and programs will work. You can see that it is.

・ Output example of NUCLEO-F401RE

TOPPERS/ASP Kernel Release 1.9.3 for stm32f401-nucleo(Cortex-M4) (Mar 24 2020, 01:13:55)
Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
                            Toyohashi Univ. of Technology, JAPAN
Copyright (C) 2004-2014 by Embedded and Real-Time Systems Laboratory
            Graduate School of Information Science, Nagoya Univ., JAPAN
Copyright (C) 2015-2016 by Education Working Group TOPPERS PROJECT

System logging task is started on port 1.
Sample program starts (exinf = 0).
task1 is running (001).   |
task1 is running (002).   |
task1 is running (003).   |
           :

・ Output example of NUCLEO-F446RE

TOPPERS/ASP Kernel Release 1.9.3 for stm32f446-nucleo-64(Cortex-M4) (Mar 24 2020, 01:27:50)
Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
                            Toyohashi Univ. of Technology, JAPAN
Copyright (C) 2004-2014 by Embedded and Real-Time Systems Laboratory
            Graduate School of Information Science, Nagoya Univ., JAPAN
Copyright (C) 2016 by Education Working Group TOPPERS PROJECT

System logging task is started on port 1.
Sample program starts (exinf = 0).
task1 is running (001).   |
task1 is running (002).   |
task1 is running (003).   |
           :

・ Output example of NUCLEO-G474RE

TOPPERS/ASP Kernel Release 1.9.3 for stm32fg474-nucleo-64(Cortex-M4) (Mar 24 2020, 01:36:13)
Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
                            Toyohashi Univ. of Technology, JAPAN
Copyright (C) 2004-2014 by Embedded and Real-Time Systems Laboratory
            Graduate School of Information Science, Nagoya Univ., JAPAN
Copyright (C) 2016-2019 by Education Working Group TOPPERS PROJECT

System logging task is started on port 1.
Sample program starts (exinf = 0).
task1 is running (001).   |
task1 is running (002).   |
task1 is running (003).   |
           :

・ STM32F7-DISCOVERY output example

TOPPERS/ASP Kernel Release 1.9.3 for stm32f7-discovery(Cortex-M7) (Mar 24 2020, 01:31:49)
Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
                            Toyohashi Univ. of Technology, JAPAN
Copyright (C) 2004-2014 by Embedded and Real-Time Systems Laboratory
            Graduate School of Information Science, Nagoya Univ., JAPAN
Copyright (C) 2015-2016 by Education Working Group TOPPERS PROJECT, JAPAN

System logging task is started on port 1.
Sample program starts (exinf = 0).
task1 is running (001).   |
task1 is running (002).   |
task1 is running (003).   |
           :

at the end

When I wrote the previous TOPPERS / ASP article, I wrote that I wanted to make an article about the user program and how to register in the Makefile, but every time, the sample program attached to TOPPERS / ASP is not interesting, so next time Would like to write an article related to applications using the build environment created this time.

Appendix: List of links

・ Build TOPPERS / ASP and try it.  https://qiita.com/Yukiya_Ishioka/items/9ecbe080939600c323c6

・ Build TOPPERS / ASP3 and try it.  https://qiita.com/Yukiya_Ishioka/items/63618319d47ac743a631

・ TOPPERS / ASP kernel page  https://www.toppers.jp/asp-kernel.html

-ASP 1.9.6 ARM Cortex-M4 architecture-GCC dependent package  https://www.toppers.jp/asp-d-download.html#arm_m4

-ASP 1.9.5 ARM Cortex-M7 architecture-GCC dependent package  https://www.toppers.jp/asp-d-download.html#arm_m7

・ Target-independent part  https://www.toppers.jp/download.cgi/asp-1.9.3.tar.gz

・ Target-dependent part  https://www.toppers.jp/download.cgi/asp_arch_arm_m4_gcc-1.9.6.tar.gz  https://www.toppers.jp/download.cgi/asp_arch_arm_m7_gcc-1.9.5.tar.gz

-Configurator Release 1.9.6  https://www.toppers.jp/download.cgi/cfg-1.9.6.tar.gz

Recommended Posts

Build and run TOPPERS / ASP (2020-03-10 version)
Build TOPPERS / ASP3 and try it
__version__ traps and best practices
Build a detonation velocity website with Cloud Run and Python (Flask)
Until you build the environment with ABCI and run MaskTrack RCNN