IoTGateway/BSP/FreeRTOS

From ESS-WIKI
Jump to: navigation, search

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

https://mcuxpresso.nxp.com/

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

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 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.

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/gcc-arm-none-eabi-9-2019-q4-major

3.Compile the demo code

To build an example application, follow these steps.

1.Extract the SDK package and change the directory to the example application project directory, which has a path similar to the following: <install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc.

For this example, the exact path is: <install_dir>/boards/evkmimx8mq/demo_apps/hello_world/armgcc

2.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

-- 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

< skip--line >

[100%] Linking C executable debug/freertos_hello.elf [100%]

Built target freertos_hello.elf

4.Run the demo application

Connect the development platform to your PC via USB cable between the USB-UART connector and the PC USB connector.

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:
  a. 115200 baud rate, depending on your board (reference BOARD_DEBUG_UART_BAUDRATE variable in board.h file)
  b. No parity
  c. 8 data bits
  d. 1 stop bit

2.Copy the compiled freertos_hello.elf to emmc's first partition

3.Start the demo under uboot

In iMX8MQ:

  emmc:

  U-Boot > fatload mmc 0:1 0x7e0000 freertos_hello.bin

  U-Boot > bootaux 0x7e0000

 sd card:

  U-Boot > fatload mmc 1:1 0x7e0000 freertos_hello.bin

  U-Boot > bootaux 0x7e0000

In iMX8MM:

   emmc:

  U-Boot > fatload mmc 1:1 0x7e0000 freertos_hello.bin

  U-Boot > bootaux 0x7e0000

   sd card:

  U-Boot > fatload mmc 0:1 0x7e0000 freertos_hello.bin

  U-Boot > bootaux 0x7e0000

In iMX8MP:

  • 5.4.24_2.1.0 BSP
    • emmc:
      • U-Boot > fatload mmc 2:1 0x48000000 imx8mp_m7_TCM_hello_world.bin;cp.b 0x48000000 0x7e0000 20000;
      • U-Boot > bootaux 0x7e0000
    • sd card:
      • U-Boot > fatload mmc 1:1 0x48000000 imx8mp_m7_TCM_hello_world.bin;cp.b 0x48000000 0x7e0000 20000;
      • U-Boot > bootaux 0x7e0000

In iMX8QM and MX8QXP:

   Need to disable the SCU debug for the ROM-5620

   Put hello_world_m40.bin to first partition and rename m4_0.bin

   U-Boot > run m4boot_0