Difference between revisions of "IoTGateway/BSP/FreeRTOS IMX8ULP"

From ESS-WIKI
Jump to: navigation, search
(Created page with " Set up imx8 cortex m4 MCUxpress SDK environment = 1.Download the SDK = Download the SDK package according to the model of the chip or board from the following website [htt...")
 
(4. Package M33 image to flash.bin)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
  
Set up imx8 cortex m4 MCUxpress SDK environment
+
Set up imx8ulp cortex m33 MCUxpress SDK environment
  
 
= 1.Download the SDK =
 
= 1.Download the SDK =
  
Download the SDK package according to the model of the chip or board from the following website
+
Download the SDK package from Advantech azure git server.
  
[https://mcuxpresso.nxp.com/ https://mcuxpresso.nxp.com/]
+
[https://AIM-Linux@dev.azure.com/AIM-Linux/RISC_MCU_SDK/_git/SDK_2_14_0_EVK9-MIMX8ULP https://AIM-Linux@dev.azure.com/AIM-Linux/RISC_MCU_SDK/_git/SDK_2_14_0_EVK9-MIMX8ULP]
 
 
It can be search by board model or imx processor, the latest SDK package available for imx8m-board is EVK-MIMX8MQ.
 
  
 
= 2.Setup the cross compiler =
 
= 2.Setup the cross compiler =
Line 16: Line 14:
 
[https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads]
 
[https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads]
  
1.It is best to download the latest version cross-compiler gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 from the site and decompression it to get the directory gcc-arm-none-eabi-9-2019-q4-major.
+
1.It is best to download the latest version cross-compiler arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz from the site and decompression it to get the directory arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.
  
 
2.Create a new system environment variable and name it ARMGCC_DIR.
 
2.Create a new system environment variable and name it ARMGCC_DIR.
Line 22: Line 20:
 
The value of this variable should point to the Arm GCC Embedded tool chain installation path. For this example, the path is:
 
The value of this variable should point to the Arm GCC Embedded tool chain installation path. For this example, the path is:
  
$ export ARMGCC_DIR=/work/platforms/tmp/gcc-arm-none-eabi-9-2019-q4-major
+
$ export ARMGCC_DIR=/work/platforms/tmp/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi
  
 
= 3.Compile the demo code =
 
= 3.Compile the demo code =
Line 28: Line 26:
 
To build an example application, follow these steps.
 
To build an example application, follow these steps.
  
1.Extract the SDK package&nbsp;and&nbsp;change the directory to the example application project directory, which has a path similar to the following:&nbsp;<install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc.
+
1.Extract the SDK package and change the directory to the following application project directory&nbsp;:
  
For this example, the exact path is: <install_dir>/boards/evkmimx8mq/demo_apps/hello_world/armgcc
+
<install_dir>/boards/evk9mimx8ulp/demo_apps/'''adv_rtdfull'''/armgcc
  
2.Run the build_debug.sh script&nbsp;in the armgcc directory to perform the build. The output is shown in this figure:<br/> chmod u+x build_debug.sh<br/> ./build_debug.sh
+
2.&nbsp;Because some contents&nbsp;of adv_rtdfull are written considering the testing and applications of the A core, users need to ensure that their modifications do not affect these parts. Otherwise, they might encounter A core boot failures
  
-- BUILD_TYPE: debug -- Configuring done -- Generating done -- Build files have been written to: /home/jinmin/nvme/imx8/mcu/boards/evkmimx8mq/rtos_examples/freertos_hello/armgcc [ 3%] Building C object CMakeFiles/freertos_hello.elf.dir/home/jinmin/nvme/imx8/mcu/boards/evkmimx8mq/rtos_examples/freertos_hello/freertos_hello.c.obj [ 7%] Building C object CMakeFiles/freertos_hello.elf.dir/home/jinmin/nvme/imx8/mcu/boards/evkmimx8mq/rtos_examples/freertos_hello/pin_mux.c.obj
+
3.Run the build_debug.sh script&nbsp;in the armgcc directory to perform the build. The output is shown in this figure:<br/> chmod u+x build_debug.sh<br/> ./build_debug.sh
  
< skip--line >
+
Built target '''sdk20-app.bin'''
  
[100%] Linking C executable debug/freertos_hello.elf [100%]
 
  
Built target freertos_hello.elf
+
= 4. Package M33 image to flash.bin =
  
= 4.Run the demo application =
+
1.&nbsp;Get imx-boot tarball from our server. Here we use ROM-2620 VC0064 as an example:
  
Connect the development platform to your PC via USB cable between the USB-UART connector and the PC USB connector.
+
$ tar xzvf 2620A1AIM34LIVC0064_iMX8ULP_1G_imx-boot.tgz
  
1.Open the terminal application on the PC, such as PuTTY or TeraTerm, and connect to the debug serial port number. Configure the terminal with these settings:<br/> &nbsp; a. 115200 baud rate, depending on your board (reference BOARD_DEBUG_UART_BAUDRATE variable in board.h file)<br/> &nbsp; b. No parity<br/> &nbsp;&nbsp;c. 8 data bits<br/> &nbsp; d. 1 stop bit
+
2.&nbsp;Replace the m33 image by pre-build sdk20-app.bin file.
  
2.Copy the compiled freertos_hello.elf to emmc's first partition
+
$ cp sdk20-app.bin 2620A1AIM34LIVC0064_iMX8ULP_1G_imx-boot/MX8ULP/m33_image.bin
  
3.Start the demo under uboot
+
3.&nbsp;Change directory to imx-boot folder, and start packaging flash.bin.
  
In iMX8MQ:
+
$ cd 2620A1AIM34LIVC0064_iMX8ULP_1G_imx-boot/
  
&nbsp; emmc:
+
$ make SOC=iMX8ULP REV=A2&nbsp;flash_singleboot_m33
  
&nbsp; U-Boot > fatload mmc 0:1 0x7e0000 freertos_hello.bin
+
Built target '''flash.bin''' in iMX8ULP subfolder.
  
&nbsp; U-Boot > bootaux 0x7e0000
+
&nbsp;
  
&nbsp;sd card:
+
= 5. Burn flash.bin int eMMC =
  
&nbsp; U-Boot > fatload mmc 1:1 0x7e0000 freertos_hello.bin
+
1.&nbsp;Config boot switch to serial download mode.
  
&nbsp; U-Boot > bootaux 0x7e0000
+
2.&nbsp;Connect OTG to PC side.
  
In iMX8MM:
+
3.&nbsp;Use UUU command as below
  
&nbsp;&nbsp; emmc:
+
$ ./uuu -b emmc flash.bin
  
&nbsp; U-Boot > fatload mmc 1:1 0x7e0000 freertos_hello.bin
+
&nbsp;
  
&nbsp; U-Boot > bootaux 0x7e0000
+
= 6. Run the demo application =
  
&nbsp;&nbsp; sd card:
+
1.&nbsp;Config boot switch to eMMC boot mode.
  
&nbsp; U-Boot > fatload mmc 0:1 0x7e0000 freertos_hello.bin
+
2.&nbsp;Connect COM (COM-E) to PC.
  
&nbsp; U-Boot > bootaux 0x7e0000
+
3.&nbsp;Power on system. And you will see below message&nbsp;:
 +
<pre>--~~~~--~~~~##################### Power Mode Switch Task --~~~~--~~~~#####################
 +
        Build Time: Jun 27 2023--09:44:46
 +
        Core Clock: 160000000Hz
 +
        Boot Type: Single Boot Type
  
In iMX8MP:
+
Select the desired test mode
 +
<Need system reboot first if you want to change to another mode>
  
*5.4.24_2.1.0 BSP
+
Press  C for test mode of CAN bus
**emmc:
+
Press  Q for test mode of QSPI
***U-Boot >&nbsp;fatload mmc 2:1 0x48000000 imx8mp_m7_TCM_hello_world.bin;cp.b 0x48000000 0x7e0000 20000;
+
Press  M for test mode of LPSPI master
***U-Boot > bootaux 0x7e0000 
+
Press  S for test mode of LPSPI slave
**sd card:
+
Press  U for test mode of LPUART
***U-Boot >&nbsp;fatload mmc 1:1 0x48000000 imx8mp_m7_TCM_hello_world.bin;cp.b 0x48000000 0x7e0000 20000;
 
***U-Boot > bootaux 0x7e0000   
 
  
In iMX8QM and MX8QXP:
+
Waiting for mode select...</pre>
  
&nbsp; &nbsp;Need to disable the SCU debug for the ROM-5620
+
&nbsp;
  
&nbsp;&nbsp; Put&nbsp;hello_world_m40.bin to first partition and rename m4_0.bin
+
&nbsp;
  
&nbsp; &nbsp;U-Boot > run m4boot_0
+
&nbsp;

Latest revision as of 11:11, 18 June 2024

Set up imx8ulp cortex m33 MCUxpress SDK environment

1.Download the SDK

Download the SDK package from Advantech azure git server.

https://AIM-Linux@dev.azure.com/AIM-Linux/RISC_MCU_SDK/_git/SDK_2_14_0_EVK9-MIMX8ULP

2.Setup the cross compiler

Download and run the installer from launchpad.net/gcc-arm-embedded. This is the actual toolset (in other words, compiler,linker, and so on).

https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads

1.It is best to download the latest version cross-compiler arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz from the site and decompression it to get the directory arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.

2.Create a new system environment variable and name it ARMGCC_DIR.

The value of this variable should point to the Arm GCC Embedded tool chain installation path. For this example, the path is:

$ export ARMGCC_DIR=/work/platforms/tmp/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi

3.Compile the demo code

To build an example application, follow these steps.

1.Extract the SDK package and change the directory to the following application project directory :

<install_dir>/boards/evk9mimx8ulp/demo_apps/adv_rtdfull/armgcc

2. Because some contents of adv_rtdfull are written considering the testing and applications of the A core, users need to ensure that their modifications do not affect these parts. Otherwise, they might encounter A core boot failures

3.Run the build_debug.sh script in the armgcc directory to perform the build. The output is shown in this figure:
chmod u+x build_debug.sh
./build_debug.sh

Built target sdk20-app.bin


4. Package M33 image to flash.bin

1. Get imx-boot tarball from our server. Here we use ROM-2620 VC0064 as an example:

$ tar xzvf 2620A1AIM34LIVC0064_iMX8ULP_1G_imx-boot.tgz

2. Replace the m33 image by pre-build sdk20-app.bin file.

$ cp sdk20-app.bin 2620A1AIM34LIVC0064_iMX8ULP_1G_imx-boot/MX8ULP/m33_image.bin

3. Change directory to imx-boot folder, and start packaging flash.bin.

$ cd 2620A1AIM34LIVC0064_iMX8ULP_1G_imx-boot/

$ make SOC=iMX8ULP REV=A2 flash_singleboot_m33

Built target flash.bin in iMX8ULP subfolder.

 

5. Burn flash.bin int eMMC

1. Config boot switch to serial download mode.

2. Connect OTG to PC side.

3. Use UUU command as below

$ ./uuu -b emmc flash.bin

 

6. Run the demo application

1. Config boot switch to eMMC boot mode.

2. Connect COM (COM-E) to PC.

3. Power on system. And you will see below message :

--~~~~--~~~~##################### Power Mode Switch Task --~~~~--~~~~#####################
        Build Time: Jun 27 2023--09:44:46
        Core Clock: 160000000Hz
        Boot Type: Single Boot Type

Select the desired test mode
<Need system reboot first if you want to change to another mode>

Press  C for test mode of CAN bus
Press  Q for test mode of QSPI
Press  M for test mode of LPSPI master
Press  S for test mode of LPSPI slave
Press  U for test mode of LPUART

Waiting for mode select...