Uboot IMX6ull hangs when setting DEBUG mode


I am trying to build uboot from the toradex repo (02735f400478c6e9afc432fda1149abef630657c (branch 2016.11 toradex)), with the DEBUG macro set in include/configs/colibri-mx6ull.h

This seems to hang in the dm_init function.
(When I build uboot without the define set, everything seems to work fine).

Is this a known issue? (Can’t imagine I am the first one to try this)

Any help/pointers are appreciated.

Kind regards,

U-Boot 2016.11-00006-gcda4ee6-dirty (Mar 15 2019 - 13:36:47 +0100)

initcall: 87810245
U-Boot code: 87800000 -> 8787B0BC  BSS: -> 878CCB74
initcall: 87801515
CPU:   Freescale i.MX6ULL rev1.0 792 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C)malloc_simple: size=10, ptr=18c, limit=400: 91fc8c
uclass_find_device_by_seq: 0 -1
uclass_find_device_by_seq: 0 0
   - -1 -1
   - not found
 at 43C
Reset cause: unknown reset
initcall: 87810269
DRAM:  initcall: 87802b41
initcall: 878103f1
Monitor len: 000CCB74
Ram size: 20000000
Ram top: A0000000
initcall: 8781013d
initcall: 878101fd
TLB table from 9fff0000 to 9fff4000
initcall: 87810341
initcall: 878101bd
Reserving 818k for U-Boot at: 9ff23000
initcall: 87810195
Reserving 41088k for malloc() at: 9d703000
initcall: 87810301
Reserving 80 Bytes for Board Info at: 9d702fb0
initcall: 87810345
initcall: 8781016d
Reserving 240 Bytes for Global Data at: 9d702ec0
initcall: 87810349
initcall: 87810339
initcall: 87810459
initcall: 878103d5
initcall: 87810359

RAM Configuration:
Bank #0: 80000000 512 MiB

DRAM:  512 MiB
initcall: 87810159
New Stack Pointer is: 9d702ea0
initcall: 8781034d
initcall: 878102a9
Relocation Offset is: 18723000
Relocating to 9ff23000, new gd at 9d702ec0, sp at 9d702ea0
initcall: 9ff33613
initcall: 9ff33499
initcall: 87810605 (relocated to 9ff33605)
dram_bank_mmu_setup: bank: 0
mmu_set_region_dcache_behaviour: start=0x00000000, size=1048575, option=0x1e
mmu_set_region_dcache_behaviour: start=0x00000009, size=131072, option=0x1e
initcall: 878104ad (relocated to 9ff334ad)
initcall: 8781060f (relocated to 9ff3360f)
initcall: 878105d5 (relocated to 9ff335d5)
Pre-reloc malloc() used 0x18c bytes (0 KB)
using memory 0x9d703000-0x9ff23000 for malloc()
initcall: 878104d5 (relocated to 9ff334d5)
initcall: 87810495 (relocated to 9ff33495)
initcall: 878105c3 (relocated to 9ff335c3)


When I set CONFIG_SYS_DCACHE_OFF, the boot works perfectly.

This is pretty problematic. My wild guess is that the mmu is improperly configured somehow.

Apparently the reason why it hung at that place, was because I also enabled CONFIG_OF_EMBED.
For the sake of not chasing too many things at once, I would propose to look at my post where I only do the minimal difference to the official toradex code, beside just enabling the DEBUG, which causes the thing to hang in NAND boot.

I did some more investigating.

I removed my “custom target” that basically copied colibri-imx6ull, and did the minimal changes required to enable debug mode:

git log
commit 02735f400478c6e9afc432fda1149abef630657c
Author: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Date:   Mon Dec 17 17:08:40 2018 +0100

apalis-tk1: remove default vesa vga mode from vidargs

diff --git a/include/configs/colibri-imx6ull.h b/include/configs/colibri-imx6ull.h
index d61e307..0ea74c5 100644
--- a/include/configs/colibri-imx6ull.h
+++ b/include/configs/colibri-imx6ull.h
@@ -274,4 +274,6 @@
 /* TODO new from mx6ullevk.h */
 #define DEBUG 

For some reason, this -does- get further, but then hangs when trying to boot from the NAND

(posting the last lines here:)

initcall: 878107cd (relocated to 9ff2f7cd)
Initial value for argc=3
Final value for argc=3
fdtdec_get_config_int: bootdelay
### main_loop entered: bootdelay=1

fdtdec_get_config_int: kernel-offset
fdtdec_get_config_int: rootdisk-offset
fdtdec_get_config_string: bootcmd
fdtdec_get_config_int: bootsecure
### main_loop: bootcmd="run ubiboot; setenv fdtfile imx6ull-colibri${variant}-${fdt_board}.dtb && run distro_bootcmd"
Hit any key to stop autoboot:  0
Initial value for argc=5
Final value for argc=5
Initial value for argc=12
Final value for argc=12
Booting from NAND...

last_ids  :
env_ids   : <NULL>
env_parts : mtdparts=gpmi-nand:512k(mx6ull-bcb),1536k(u-boot1)ro,1536k(u-boot2)ro,512k(u-boot-env),-(ubi)

last_partition :
env_partition  : <NULL>
mtdids variable not defined, using default
Initial value for argc=3
Final value for argc=3

mtdids = nand0=gpmi-nand

+ id nand0             536870912 bytes  gpmi-nand


When not enabling the DEBUG define, the boot works just fine.
But strangly enough, disabling the caches here does not fix it!

I dont yet know why making my other target changes the behavior + what the role of the caches is.

I think it would be nice if someone could also try building a DEBUG variant and look into what is happening:)

Kind regards,

So the final issue that it hung during NAND boot turned out to be the following:

diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index b9b160d..f917457 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -1548,7 +1548,7 @@ static int parse_mtdparts(const char *const mtdparts)
        int err = 1;
        char tmp_parts[MTDPARTS_MAXLEN];
-       debug("\n---parse_mtdparts---\nmtdparts = %s\n\n", p);
+       //debug("\n---parse_mtdparts---\nmtdparts = %s\n\n", p);
        /* delete all devices and partitions */
        if (mtd_devices_init() != 0) {

The dereferencing of the uninited pointer p caused an abort in uboot, only during the DEBUG define. When applying this patch, the system does boot into linux

The other issue I had was because I enabled CONFIG_OF_EMBED.
I am not yet sure why this only caused issues in the debug build, and the link with the caches it not yet clear either. But ok, I can progress.

Kind regards,

Hi @Arnout

DEBUG macro set in include/configs/colibri-mx6ull.h

What is your application?

Is this a known issue? (Can’t imagine I am the first one to try this)

We never heard of this issue before.

Any help/pointers are appreciated.

You should not enable globally the debug function but more try to enable the DEBUG function in file you need.

Best regards,