Booting with a baremetal program on Imx7 board

For better understanding and study of the boot process, I want to load my bare metal c program to run. I do not want to run any OS on my board.
I want to run my program on Cortex A core first and then on Cortex M to do some tests. Please provide me hint, how to load my compiled bare metal program in respective cores on boot up. Thanks.

Greetings @nadim4114!

We only support running operating systems on the Cortex-A cores on our SoMs. While it should be possible to run bare metal C code on these cores, it’s not something we actually support.

If your goal is to study and understand the boot process, I’d suggest you to investigate the U-Boot sources and check how they bring it up.

On the other hand, you can easily load bare metal C applications on the Cortex-M4 core as stated in this article.

The link which you shared for U-Boot sources is very weird. What is it actually?

There is not a very good explanation of getting started with Rtos on M4 core. Can you link me to one?

@nadim4114,

This is our git repository for U-Boot. You can browse the files by clicking on the “tree” tab (or git clone it to your machine).

This article I linked before shows how to get started with the examples bundled with FreeRTOS. It will guide you on how to compile and load such examples.

This article describes in details how to get U-Boot source and compile it.
You can also use U_Boot to load and start your baremetal application same way it’s done for Linux kernel.

I will check and update to you.

I’ll be patiently waiting…

i followed the guide and reached till making the config files with the command as follows:

nadim4114@ubuntu:~/u-boot-toradex$ echo ${CC}
arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi
nadim4114@ubuntu:~/u-boot-toradex$ export ARCH=arm
nadim4114@ubuntu:~/u-boot-toradex$ export PATH=~/gcc-linaro/bin/:$PATH
nadim4114@ubuntu:~/u-boot-toradex$ export CROSS_COMPILE=arm-linux-gnueabihf-
nadim4114@ubuntu:~/u-boot-toradex$ ARCH=arm
nadim4114@ubuntu:~/u-boot-toradex$ export ARCH=arm
nadim4114@ubuntu:~/u-boot-toradex$ export PATH=~/gcc-linaro/bin/:$PATH
nadim4114@ubuntu:~/u-boot-toradex$ export CROSS_COMPILE=arm-linux-gnueabihf-
nadim4114@ubuntu:~/u-boot-toradex$ export PATH=$PATH:$HOME/u-boot-toradex/tools
nadim4114@ubuntu:~/u-boot-toradex$ make colibri_imx7_emmc_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#

I am now stuck at this step to compile the uboot. Actually i am not sure whether i am giving the right command because there are many different ways shown here which make it very confusing to follow.
so i gave the following commands one by one to find the correct one:

command-1. nadim4114@ubuntu:~/u-boot-toradex$ make -j3 2>&1 | tee build.log
 i get the following error:
make: arm-linux-gnueabihf-gcc: Command not found
/bin/sh: 1: arm-linux-gnueabihf-gcc: not found
dirname: missing operand
Try 'dirname --help' for more information.
scripts/kconfig/conf  --syncconfig Kconfig
./scripts/binutils-version.sh: line 18: arm-linux-gnueabihf-as: command not found
  CHK     include/config.h
  UPD     include/config.h
  CFG     u-boot.cfg
/bin/sh: 1: arm-linux-gnueabihf-gcc: not found
  GEN     include/autoconf.mk.dep
/bin/sh: 1: arm-linux-gnueabihf-gcc: not found
make[1]: *** [scripts/Makefile.autoconf:77: u-boot.cfg] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/Makefile.autoconf:48: include/autoconf.mk.dep] Error 1
make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'.  Stop.

 command-2. make CC='arm-angstrom-linux-gnueabi-gcc  --sysroot=${HOME}/oe-core/build/out-glibc/sysroots/colibri-imx7_emmc'
i get the following error
./scripts/binutils-version.sh: line 18: arm-linux-gnueabihf-as: command not found
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
/bin/sh: 1: arm-linux-gnueabihf-ld: not found
  UPD     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CC      lib/asm-offsets.s
  CHK     include/generated/generic-asm-offsets.h
  CC      arch/arm/lib/asm-offsets.s
  CHK     include/generated/asm-offsets.h
  HOSTCC  tools/mkenvimage.o
  HOSTLD  tools/mkenvimage
  HOSTCC  tools/fit_image.o
  HOSTCC  tools/image-host.o
  HOSTCC  tools/dumpimage.o
  HOSTLD  tools/dumpimage
  HOSTCC  tools/mkimage.o
  HOSTLD  tools/mkimage
  LD      arch/arm/cpu/built-in.o
/bin/sh: 1: arm-linux-gnueabihf-ar: not found
make[1]: *** [scripts/Makefile.build:355: arch/arm/cpu/built-in.o] Error 127
make: *** [Makefile:1594: arch/arm/cpu] Error 2
  1. i tried many more randomly.

At this link1

A step also in future i would want to link binary demo program to U-boot. I am following this link.
What is the meaning of this command

make CONFIG_STANDALONE_LOAD_ADDR=0x11000000 -j 3

When to run this?

Actually in the end i want to completely build the U-boot and boot my board with that and run the linked binary demo program to it so that i have a better idea how to play with U-BOOT.

Best Regards

@alex.tx , Please suggest me where the problem lies so that I can proceed.

Regards

hi @nadim4114

make: arm-linux-gnueabihf-gcc: Command not found
/bin/sh: 1: arm-linux-gnueabihf-gcc: not found

Your Toolchain seems not to be correctly configured.

When I give echo $ {CC}, I get the name of toolchain. Can you give tested toolchain?
Actually me any my team are following this portal to start something but we are really frustrated.
Hardly 10% of things have worked for us whichever we followed.
Either some are explained in a very complex way or we get some errors while following.
We followed getting started guide and are able to build only a simple hello world program and run on hardware. That’s all we are able to do.
We need to start development but either there is a toolchain problem or some other issue.
Please give me a link for a tested toolchain and I will check on that.
Once again, I am following the tutorials and downloaded the toolchain from toradex website only still there is problem then i doubt if I will be able to develop my product on toradex boards.

I have followed this and completed build from commandline. If tolchain is not configured correctly then it will also not work

HI @nadim4114

Sorry for the delayed answer.

The tested Toolchain is already on the developer Website and it is working fine for most of our customers.

I don’t understand why this is not working for you. Could you share which U-Boot branch you are trying to compile and post your errors in text format?

Thanks and best regards,
Jaski