Hello,
I'm using the Boundary Devices Nitrogen 6SoloX board, which, out of the box loads the M4 into OCRAM (address 0x09000000). Unfortunately, OCRAM is restricted to 128kB and so I looked at loading the M4 binary into DDR (address 0x80000000).
I followed the guide "How to Run the MQX™ RTOS on Various RAM Memories for i.MX 6SoloX":
http://cache.nxp.com/files/microcontrollers/doc/app_note/AN5127.pdf
Configuring u-boot, the kernel, and MQX was fairly straight forward and I completed every step in the process.
MQX
MEMORY
{
text (RX): ORIGIN = 0x80000000, LENGTH = 0x00800000 /* DDR */
data (RW): ORIGIN = 0x20000000, LENGTH = 0x00007E00 /* TCMU */
}
U-Boot
#define PHYS_SDRAM (MMDC0_ARB_BASE_ADDR + SZ_16M) // i.e. 0x81000000
#define PHYS_SDRAM_SIZE (SZ_1G - SZ_16M)
6x_bootscript
I also had to change the "6x_bootscript" that is used to load Linux from u-boot:
a_script=0x81008000
a_zImage=0x81008000
a_fdt=0x83000000
a_ramdisk=0x83800000
a_initrd=0x83a00000
The M4 loads without issue and Linux also loads without any problems. My issue is that at some point during Linux booting, the M4 sometimes hangs, or gives garbled output before hanging.
My boot messages are
U-Boot 2015.07 (Jan 20 2016 - 11:40:57 -0800)
CPU: Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)
Reset cause: POR
Board: Nitrogen6sx
I2C: ready
DRAM: 1008 MiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1
SF: Detected SST25VF016B with page size 256 Bytes, erase size 4 KiB, total 2 MiB
In: serial
Out: serial
Err: serial
Net: using phy at 4
using phy at 5
FEC0 [PRIME], FEC1, usb_ether
Error: usb_ether address not set.
Hit any key to stop autoboot: 1 0
switch to partitions #0, OK
mmc0 is current device
reading /6x_bootscript
3632 bytes read in 14 ms (252.9 KiB/s)
## Executing script at 80008000
reading m4_ddr.bin
** Unable to read file m4_ddr.bin **
## Starting auxiliary core at 0x80000000 ...
reading uEnv.txt
** Unable to read file uEnv.txt **
reading /imx6sx-nitrogen6sx-m4.dtb
44936 bytes read in 20 ms (2.1 MiB/s)
Setting bus to 1
Error writing the chip: -19
reading /zImage
5001552 bytes read in 234 ms (20.4 MiB/s)
Kernel image @ 0x81008000 [ 0x000000 - 0x4c5150 ]
## Flattened Device Tree blob at 83000000
Booting using the fdt blob at 0x83000000
reserving fdt memory region: addr=83000000 size=b000
Using Device Tree in place at 83000000, end 8300dfff
Starting kernel ...
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpu
Linux version 3.14.38-prenav+yocto+g4af577c (prenav@prenav-finn) (gcc version 5.3.0 (GCC) ) #4 SMP PREEMPT Wed Jan 20 12:02:18 PST 2016
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: Freescale i.MX6 SoloX Nitrogen6sx Board
cma: CMA: reserved 320 MiB at aa000000
Memory policy: Data cache writealloc
PERCPU: Embedded 7 pages/cpu @c063a000 s8192 r8192 d12288 u32768
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 255778
Kernel command line: console=ttymxc0,115200 vmalloc=400M consoleblank=0 rootwait fixrtc root=/dev/mmcblk0p2
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 684104K/1031168K available (6427K kernel code, 292K rwdata, 2128K rodata, 284K init, 420K bss, 347064K reserved, 0K highmem)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc1000000 - 0xff000000 ( 992 MB)
lowmem : 0x82000000 - 0xc0f00000 (1007 MB)
pkmap : 0x81e00000 - 0x82000000 ( 2 MB)
modules : 0x81000000 - 0x81e00000 ( 14 MB)
.text : 0x82008000 - 0x82863074 (8557 kB)
.init : 0x82864000 - 0x828ab000 ( 284 kB)
.data : 0x828ac000 - 0x828f5080 ( 293 kB)
.bss : 0x828f508c - 0x8295e128 ( 421 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
NR_IRQS:16 nr_irqs:16 16
L310 cache controller enabled
l2x0: 16 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x32030000, Cache size: 256 kB
Switching to timer-based delay loop
sched_clock: 32 bits at 3000kHz, resolution 333ns, wraps every 1431655765682ns
clocksource_of_init: no matching clocksources found
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 6.00 BogoMIPS (lpj=30000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x8164c7e8 - 0x8164c840
Brought up 1 CPUs
SMP: Total of 1 processors activated (6.00 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
pinctrl core: initialized pinctrl subsystem
regulator-dummy: no parameters
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
Use WDOG1 as reset source
syscon 20c8000.anatop: regmap [mem 0x020c8000-0x020c8fff] registered
vdd1p1: 800 <--> 1375 mV at 1100 mV
vdd3p0: 2625 <--> 3400 mV at 3000 mV
vdd2p5: 2100 <--> 2875 mV at 2500 mV
cpu: 725 <--> 1450 mV at 1150 mV
vddpcie-phy: 725 <--> 1450 mV at 1100 mV
vddsoc: 725 <--> 1450 mV at 1175 mV
syscon 20e4000.iomuxc-gpr: regmap [mem 0x020e4000-0x020e7fff] registered
syscon 21bc000.ocotp-ctrl: regmap [mem 0x021bc000-0x021bffff] registered
syscon 21ac000.romcp: regmap [mem 0x021ac000-0x021affff] registered
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
imx6sx-pinctrl 20e0000.iomuxc: initialized IMX pinctrl driver
20dc000.gpc supply pu not found, using dummy regulator
MU is ready for cross core communication!
bio: create slab <bio-0> at 0
1P8V: 1800 mV
2P5V: 2500 mV
3P3V: 3300 mV
wlan-en: 3300 mV
2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 58, base_baud = 5000000) is a IMX
console [ttymxc0] enabled
21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 60, base_baud = 5000000) is a IMX
21f4000.serial: ttymxc4 at MMIO 0x21f4000 (irq = 62, base_baud = 5000000) is a IMX
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c i2c-0: IMX I2C adapter registered
i2c i2c-1: IMX I2C adapter registered
i2c i2c-2: IMX I2C adapter registered
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
MIPI CSI2 driver module loaded
Advanced Linux Sound Architecture Driver Initialized.
Bluetooth: Core ver 2.18
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
Switched to clocksource mxc_timer1
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP: reno registered
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
Bus freq driver module loaded
futex hash table entries: 256 (order: 2, 16384 bytes)
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
squashfs: version 4.0 (2009/01/31) Phillip Lougher
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
fuse init (API version 7.22)
msgmni has been set to 1976
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
tfp410 1-0038: i2c block read failed, retry=0
tfp410 1-0038: i2c block read failed, retry=1
tfp410 1-0038: i2c block read failed, retry=2
tfp410 1-0038: i2c block read failed, retry=3
tfp410 1-0038: i2c block read failed, retry=4
tfp410 1-0038: i2c block read failed, retry=5
tfp410 1-0038: i2c block read failed, retry=6
tfp410 1-0038: i2c block read failed, retry=7
tfp410: probe of 1-0038 failed with error -5
i2c-core: driver [tfp410] using legacy suspend method
i2c-core: driver [tfp410] using legacy resume method
add tfp410 i2c driver
ldb ldb.14: failed to get clk choice0
ldb ldb.14: failed to get clk choice1
ldb ldb.14: failed to get clk choice2
ldb ldb.14: failed to get clk choice3
DISPLAY: Power-on latency exceeded, new value 28000 ns
Console: switching to colour frame buffer device 160x45
DISPLAY: Power-off latency exceeded, new value 27000 ns
DISPLAY: Power-on latency exceeded, new value 30333 ns
mxsfb 2220000.lcdif: initialized
imx-sdma 20ec000.sdma: no iram assigned, using external mem
imx-sdma 20ec000.sdma: no event needs to be remapped
imx-sdma 20ec000.sdma: loaded firmware 3.1
imx-sdma 20ec000.sdma: initialized
serial: Freescale lpuart driver
imx sema4 driver is registered.
IMX MCC libmcc TTY driver module loaded
[drm] Initialized drm 1.1.0 20060810
[drm] Initialized vivante 1.0.0 20120216 on minor 0
brd: module loaded
loop: module loaded
[max77823_init] start
m25p80 spi0.0: sst25vf016b (2048 Kbytes)
4 ofpart partitions found on MTD device spi0.0
Creating 4 MTD partitions on "spi0.0":
0x000000000000-0x0000000c0000 : "U-Boot"
ftl_cs: FTL header not found.
0x0000000c0000-0x0000000c2000 : "env"
ftl_cs: FTL header not found.
0x0000000c2000-0x0000001e0000 : "Kernel"
ftl_cs: FTL header not found.
0x0000001e0000-0x000000200000 : "M4"
ftl_cs: FTL header not found.
spi_imx 2008000.ecspi: probed
CAN device driver interface
phyirq=164
pps pps0: new PPS source ptp0
libphy: fec_enet_mii_bus: probed
fec 2188000.ethernet eth0: registered PHC device 0
phyirq=168
pps pps1: new PPS source ptp1
fec 21b4000.ethernet eth1: registered PHC device 1
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
usbcore: registered new interface driver cdc_acm
cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver cp210x
usbserial: USB Serial support registered for cp210x
usbcore: registered new interface driver ftdi_sio
usbserial: USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver keyspan
usbserial: USB Serial support registered for Keyspan - (without firmware)
usbserial: USB Serial support registered for Keyspan 1 port adapter
usbserial: USB Serial support registered for Keyspan 2 port adapter
usbserial: USB Serial support registered for Keyspan 4 port adapter
usbcore: registered new interface driver pl2303
usbserial: USB Serial support registered for pl2303
usbcore: registered new interface driver qcserial
usbserial: USB Serial support registered for Qualcomm USB modem
2184800.usbmisc supply vbus-wakeup not found, using dummy regulator
mousedev: PS/2 mouse device common for all mice
i2c-core: driver [crtouch] using legacy suspend method
i2c-core: driver [crtouch] using legacy resume method
egalax_ts 2-0004: Failed to read firmware version
egalax_ts: probe of 2-0004 failed with error -5
ft5x06-ts 2-0038: ft5x06: Could not detect touch screen.
ft5x06: ts_init
check_alarm_past: alarm in the past
snvs_rtc 20cc034.snvs-rtc-lp: rtc core: registered 20cc034.snvs-rtc-lp as rtc0
i2c /dev entries driver
pxp-v4l2 pxp_v4l2_out.18: initialized
i2c-core: driver [mag3110] using legacy suspend method
i2c-core: driver [mag3110] using legacy resume method
imx2-wdt 20bc000.wdog: IMX2+ Watchdog Timer enabled. timeout=60s (nowayout=0)
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
sdhci-esdhc-imx 2194000.usdhc: could not get ultra high speed state, work on normal mode
mmc0: no vqmmc regulator found
mmc0: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA
sdhci-esdhc-imx 2198000.usdhc: could not get ultra high speed state, work on normal mode
mmc2: no vqmmc regulator found
mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new high speed SDHC card at address 59b4
mmcblk0: mmc0:59b4 USD 3.74 GiB
mmcblk0: p1 p2
mmc2: SDHCI controller on 2198000.usdhc [2198000.usdhc] using ADMA
mmc1: no vqmmc regulator found
mmc1: SDHCI controller on 219c000.usdhc [219c000.usdhc] using ADMA
mmc1: BKOPS_EN bit is not set
mmc1: new HS200 MMC card at address 0001
mmcblk1: mmc1:0001 S10004 3.56 GiB
mmcblk1boot0: mmc1:0001 S10004 partition 1 4.00 MiB
mmcblk1boot1: mmc1:0001 S10004 partition 2 4.00 MiB
mmcblk1rpmb: mmc1:0001 S10004 partition 3 4.00 MiB
caam 2100000.caam: Instantiated RNG4 SH0
mmcblk1: unknown partition table
mmcblk1boot1: unknown partition table
mmcblk1boot0: unknown partition table
caam 2100000.caam: Instantiated RNG4 SH1
caam 2100000.caam: device ID = 0x0a160100 (Era 4)
caam 2100000.caam: job rings = 2, qi = 0
caam algorithms registered in /proc/crypto
caam_jr 2101000.jr0: registering rng-caam
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
sgtl5000 0-000a: sgtl5000 revision 0x11
init_gpio_data:-2
init_gpio_data:118
0-000a: 1200 mV normal
sgtl5000 0-000a: Using internal LDO instead of VDDD
imx-sgtl5000 sound_sgtl5000.20: sgtl5000 <-> 2028000.ssi mapping ok
NET: Registered protocol family 26
TCP: cubic registered
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM ver 1.11
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: BNEP socket layer initialized
8021q: 802.1Q VLAN Support v1.8
rfkill_gpio bt_rfkill.17: bt_rfkill device registered.
Key type dns_resolver registered
cpu cpu0: dev_pm_opp_get_opp_count: device OPP not found (-19)
Registering SWP/SWPB emulation handler
A9-M4 sema4 num 6, A9-M4 magic number 0x12345678 - 0x5e48fabc.
imx6q-pcie 8ffc000.pcie: phy link never came up
imx6q-pcie 8ffc000.pcie: Failed to bring link up!
imx6q-pcie 8ffc000.pcie: failed to initialize host
imx6q-pcie: probe of 8ffc000.pcie failed with error -22
wlan-en: disabling
regulator-dummy: disabling
snvs_rtc 20cc034.snvs-rtc-lp: setting system clock to 1970-01-01 00:00:01 UTC (1)
ALSA device list:
#0: imx6sx-nitrogen6sx-sgtl5000
EXT3-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (240)
EXT2-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (244)
EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
EXT4-fs (mmcblk0p2): write access will be enabled during recovery
random: nonblocking pool is initialized
EXT4-fs (mmcblk0p2): recovery complete
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
devtmpfs: mounted
Freeing unused kernel memory: 284K (82864000 - 828ab000)
INIT: version 2.88 booting
Starting udev
udevd[157]: starting version 182
EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
bootlogd: cannot allocate pseudo tty: No such file or directory
Populating dev cache
tar: dev/disk/by-label/Bootx20nitrog: No such file or directory
tar: error exit delayed from previous errors
udev-cache: update failed!
Thu Jan 21 04:07:41 UTC 2016
INIT: Entering runlevel: 5
Configuring network interfaces... fec 2188000.ethernet eth0: Freescale FEC PHY driver [Atheros 8035 ethernet] (mii_bus:phy_addr=2188000.ethernet:04, irq=164)
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
The M4 seems to hang somewhere around the Freeing unused kernel memory message.
Something is obviously accessing memory where the M4 is in DDR, but how can I troubleshoot this?
I've tried:
Thanks
/ Finn
Hi Finn,
Have you ensured the DDR boundaries for MQX and Linux in order to avoid memory overlay? These details are mentioned on section 3.1 of the application note that you referred:
Hope this will be useful for you.
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Finn,
The "Freeing unused memory" is displayed when the kernel starts the user-space init process. If you think that is when the error occurs, could you make a test where you removed the init process from your rootfs? This will crash the Linux bootup but it'd be good to see if the M4 is still running at that time, although I don't suspect the user-space to be an issue here.
Otherwise, have you tried a different place of RAM, at the end for instance like we do for the shared memory. Can you try that and update the "linux,usable-memory" accordingly?
Hope this helps.
Regards,
Gary