Project

General

Profile

Auto run of application file (loaded in NAND Flash)

Added by Vivek Ponnani over 2 years ago

Hi,

I have a custom board with
-- MityDspl-138F module (with FPGA)
-- No Ethernet port
-- UART,USB,SD CARD interface

We are using MMC card for booting linux and to copy application software files to board.

we have done following steps till date.

-- I have built VM with MityDSP Critical_Link_Unified_VM_14-04_04-2017.ova file from critical link.
-- I have successfully run the example programs.
-- I have build new kernel with Analog Expansion support. We followed https://support.criticallink.com/redmine/projects/90-000173/wiki for the build of new kernel.
-- I have prepared SD card and copy new Linux kernel and its file system. And also inserted the modules under /lib/modules/3.2.0+/extra as per the https://support.criticallink.com/redmine/projects/90-000173/wiki

Now, I want Linux kernel and FPGA image in SPI flash, Kernel Filesystem in NAND partition and application software image in NAND (userfs) partition.

Please answer my below queries.

1) Steps to program FPGA in SPI flash.

From the page https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Programming_the_FPGA
U-Boot > loadb 0xC0700000
  1. Ready for binary (kermit) download to 0xC0700000 at 115200 bps...
  2. Total Size = 0x00071544 = 464196 Bytes
  3. Start Addr = 0xC0700000

uBoot> sf probe 0
uBoot> sf erase 0x580000 0x80000
uBoot> sf write 0xC0700000 0x580000 ${filesize}

uBoot> setenv progfpga "sf probe 0; sf read 0xc0700000 0x580000 0x80000; loadfpga 0xc0700000"
uBoot> setenv bootcmd "run progfpga"
uBoot> saveenv

On restart every time FPGA will be programmed from the file stored in SPI flash, right?

2) Steps to load Linux kernel image to SPI flash.

U-Boot > mmcinfo
U-Boot > ext2load mmc 0:1 c0700000 /boot/uImage

u-Boot> sf probe 0
u-Boot> sf erase 0x100000 0x300000
u-Boot> sf write 0xC0700000 0x100000 0x26E3C8--> (size of uImage on MMC Card)

above command will load Linux Kernel to SPI flash, right?

3) Steps to load Linux file system in NAND (rootfs)

u-Boot> mw.b 0xC2000000 0xFF 0x06000000
u-Boot> ext2load mmc 0:1 C2000000 /media/mmcblk0p1/home/root/root_filesystem.jffs2
u-Boot> nand erase 0 0x8000000
u-Boot> nand write.jffs2 0xC2000000 0 0x05188000 --> (calculated size of .jffs2 file)

above command will load Linux File system to NAND flash, right?

4) Auto load kernel from SPI flash and file system from the NAND on power on.

U-Boot> setenv bootcmd "sf probe 0; sf read 0xc0700000 0x100000 0x300000;setenv bootargs mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw noatime rootfstype=jffs2 ip=off;bootm 0xc0700000"

U-Boot> saveenv

on restart,load kernel and filesystem from SPI flash and NAND Flash respectively and run automatically, right?

As currently, we are using MMC card to boot linux ,we setup environment with below command.We have connected serial port and giving commands from teraterm.

U-Boot > setenv bootargs mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mmcblk0p1 rw rootwait ip=off
U-Boot > ext2load mmc 0:1 c0700000 /boot/uImage
//The response is as below
/////////////////////////////////////////////////////////////////////
Loading file "/boot/uImage" from mmc device 0:1 (xxa1)
2548672 bytes read
U-Boot > bootm
  1. Booting kernel from Legacy Image at c0700000 ...
    Image Name: Linux-3.2.0+
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 2548608 Bytes = 2.4 MB
    Load Address: c0008000
    Entry Point: c0008000
    Verifying Checksum ... OK
    Loading Kernel Image ... OK
    OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 3.2.0+ (mitydsp@vagrantup) (gcc version 4.5.4 20120305 (prerelease) (GCC) ) #1 PREEMPT Tue Jul 18 01:50:50 EDT 2017
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: MityDSP-L138/MityARM-1808
Ignoring unrecognised tag 0x42000101
Memory policy: ECC disabled, Data cache writethrough
DaVinci da850/omap-l138/am18x variant 0x1
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 24384
Kernel command line: mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mmcblk0p1 rw rootwait ip=off
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 96MB = 96MB total
Memory: 91328k/91328k available, 6976k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc6800000 - 0xfea00000 ( 898 MB)
lowmem : 0xc0000000 - 0xc6000000 ( 96 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc0536834 (5307 kB)
.init : 0xc0537000 - 0xc0560000 ( 164 kB)
.data : 0xc0560000 - 0xc05c00c0 ( 385 kB)
.bss : 0xc05c00e4 - 0xc05ecaf0 ( 179 kB)
NR_IRQS:245
Console: colour dummy device 80x30
Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
DaVinci: 144 gpio irqs
print_constraints: dummy:
NET: Registered protocol family 16
baseboard_pre_init: Entered
mityomapl138_setup_nand: using 8 bit data
baseboard_init [IndustrialIO]...
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
print_constraints: VDCDC1: 1150 <--> 1350 mV at 1200 mV
print_constraints: VDCDC2: 1800 mV
print_constraints: VDCDC3: 1200 mV
print_constraints: LDO1: 1800 mV
print_constraints: LDO2: 2500 <--> 3300 mV at 3300 mV
Advanced Linux Sound Architecture Driver Version 1.0.24.
Switching to clocksource timer0_1
musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
Waiting for USB PHY clock good...
musb-hdrc musb-hdrc: USB OTG mode controller at fee00000 using PIO, IRQ 58
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 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.
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 178
io scheduler noop registered (default)
start plist test
end plist test
Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a 16550A
serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a 16550A
console [ttyS1] enabled
serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a 16550A
brd: module loaded
at24 1-0050: 256 byte 24c02 EEPROM, read-only, 0 bytes/write
MityOMAPL138: Found MAC = 40:d8:55:17:c7:d1
MityOMAPL138: Part Number = L138-FG-225-RC
ONFI flash detected
ONFI param page 0 valid
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08ABAEAWP)
Bad block table found at page 131008, version 0x01
Bad block table found at page 130944, version 0x01
Creating 2 MTD partitions on "davinci_nand.1":
0x000000000000-0x000008000000 : "rootfs"
0x000008000000-0x000010000000 : "homefs"
davinci_nand davinci_nand.1: controller rev. 2.5
spi_davinci spi_davinci.1: DMA: supported
spi_davinci spi_davinci.1: DMA: RX channel: 18, TX channel: 19, event queue: 0
m25p80 spi1.0: m25p64-nonjedec (8192 Kbytes)
Creating 8 MTD partitions on "m25p80":
0x000000000000-0x000000010000 : "ubl"
0x000000010000-0x000000090000 : "u-boot"
0x000000090000-0x0000000a0000 : "u-boot-env"
0x0000000a0000-0x0000000b0000 : "periph-config"
No LCD configured
MII PHY configured
0x0000000b0000-0x000000100000 : "reserved"
0x000000100000-0x000000400000 : "kernel"
0x000000400000-0x000000600000 : "fpga"
0x000000600000-0x000000800000 : "spare"
spi_davinci spi_davinci.1: Controller at 0xfef0e000
CAN device driver interface
mcp251x spi1.1: MCP251x didn't enter in conf mode after reset
mcp251x spi1.1: Probe failed
mcp251x spi1.1: probe failed
davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
davinci_mdio davinci_mdio.0: no live phy, scanning all
davinci_mdio: probe of davinci_mdio.0 failed with error -5
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci ohci.0: DA8xx OHCI
ohci ohci.0: new USB bus registered, assigned bus number 1
Waiting for USB PHY clock good...
ohci ohci.0: irq 59, io mem 0x01e25000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
omap_rtc: RTC power up reset detected
i2c /dev entries driver
cpuidle: using governor ladder
cpuidle: using governor menu
davinci_mmc davinci_mmc.0: Using DMA, 4-bit mode
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
mmc0: new SDHC card at address 8eeb
mmcblk0: mmc0:8eeb SD04G 3.69 GiB
mmcblk0: p1
dsd1791 spi1.2: Failed to add route LLOUT->Line Out
asoc: dsd1791 <-> davinci-mcasp.0 mapping ok
ALSA device list:
#0: MityDSP-L138 INDIO
TCP cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20090105 abi 8)
NET: Registered protocol family 29
can: raw protocol (rev 20090105)
regulator_init_complete: LDO2: incomplete constraints, leaving on
regulator_init_complete: LDO1: incomplete constraints, leaving on
regulator_init_complete: VDCDC3: incomplete constraints, leaving on
regulator_init_complete: VDCDC2: incomplete constraints, leaving on
regulator_init_complete: VDCDC1: incomplete constraints, leaving on
console [netcon0] enabled
netconsole: network logging started
omap_rtc omap_rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
kjournald starting. Commit interval 5 seconds
EXT3-fs (mmcblk0p1): using internal journal
EXT3-fs (mmcblk0p1): mounted filesystem with writeback data mode
VFS: Mounted root (ext3 filesystem) on device 179:1.
devtmpfs: mounted
Freeing init memory: 164K
Failed to mount /sys/kernel/security: No such file or directory

Welcome to The Ångström Distribution!

NET: Registered protocol family 10
Starting LSB: The RPC portmapper...
Starting udev Coldplug all Devices...
Starting Remount API VFS...
Started Set Up Additional Binary Formats [ OK ]
Starting Debug File System...
Starting Journal Service...
Started Journal Service [ OK ]
Starting POSIX Message Queue File System...
Starting Apply Kernel Variables...
Started Huge Pages File System [ OK ]
Starting Load Kernel Modules...
Starting File System Check on Root Device...
Starting udev Kernel Device Manager...
Starting Temporary Directory...
Started LSB: The RPC portmapper [ OK ]
Started Remount API VFS [ OK ]
Started Debug File System [ OK ]
Started POSIX Message Queue File System [ OK ]
udevd1106: starting version 182
Started udev Kernel Device Manager [ OK ]
Started Apply Kernel Variables [ OK ]
Started Load Kernel Modules [ OK ]
Started File System Check on Root Device [ OK ]
Started Temporary Directory [ OK ]
Starting Remount Root FS...
Started FUSE Control File System [ OK ]
Started Configuration File System [ OK ]
Started Remount Root FS [ OK ]
Started Run pending postinsts [ OK ]
Starting Load Random Seed...
Starting Recreate Volatile Files and Directories...
Started Machine ID first boot configure [ OK ]
Started Load Random Seed [ OK ]
Started Recreate Volatile Files and Directories [ OK ]
Starting Restore Sound Card State...
Starting Timestamping service...
Started Timestamping service [ OK ]
Started SSH Key Generation [ OK ]
Starting Permit User Sessions...
Started Permit User Sessions [ OK ]
Started Restore Sound Card State [ OK ]
Starting Serial Getty on ttyS1...
Started Serial Getty on ttyS1 [ OK ]

.---O---. | | .-. o o | | |-----.-----.-----.| | .----..-----.-----. | | | __ | ---'| '--.| .-'| | | | | | | | |--- || --'| | | ' | | | |
'---'---'--'--'--. |-----''----''--' '-----'-'-'-'
' |
'--
'

The Angstrom Distribution mityomapl138 ttyS1

Angstrom v2012.05 - Kernel 3.2.0+

mityomapl138 login: Started udev Coldplug all Devices [ OK ]
Starting Networking...
PHY 0:03 not found
net eth0: could not connect to phy 0:03
ADDRCONF: eth0: link is not ready
portmap1079: Starting portmap daemon...
Started Networking [ OK ]
Starting DropBear SSH Server...
Started DropBear SSH Server [ OK ]
Starting Getty on tty1...
Started Getty on tty1 [ OK ]

.---O---. | | .-. o o | | |-----.-----.-----.| | .----..-----.-----. | | | __ | ---'| '--.| .-'| | | | | | | | |--- || --'| | | ' | | | |
'---'---'--'--'--. |-----''----''--' '-----'-'-'-'
' |
'--
'

The Angstrom Distribution mityomapl138 ttyS1

Angstrom v2012.05 - Kernel 3.2.0+

mityomapl138 login:
//////////////////////////////////////////////////////////////////////////

5) In the above response, when the boot process reaches to line

Started Getty on tty1 [ OK ]

we have to press any key to continue boot process , otherwise its waiting there for infinite time.As we are planning to run the system automatically without any user input, What is the solution for this problem?

6) The screen Prompts for mityomapl138 login:. We enter root login and it gives root@mityomapl138:~#. Then we give following commands to run our application. TestAdcDacRtARM and TestAdcDacRtDSP.out are our application generated file for ARM and DSP respectively.

root@mityomapl138:~# mount
root@mityomapl138:~# cp /media/mmcblk0p1/home/root/TestAdcDacRtARM /tmp/
root@mityomapl138:~# cp /media/mmcblk0p1/home/root/TestAdcDacRtDSP.out /tmp/
root@mityomapl138:~# insmod /lib/modules/$(uname -r)/extra/dsplinkk.ko
DSPLINK Module (1.65.00.03) created on Date: Jan 13 2014 Time: 16:10:29
root@mityomapl138:~# ./TestAdcDacRtARM TestAdcDacRtDSP.out

For auto run of application from the flash ,we can not enter mityomapl138 login:. could you please explain how to do above process in auto run of application with example?

As per my understanding I can write my application generated files to NAND flash with nand write command on uBoot prompt and read at RAM location with nand read command on uBoot prompt. Then How should I put command to auto run my application files from that RAM location?

6) which command I need to auto run below command to insert dsplink file?

root@mityomapl138:~# insmod /lib/modules/$(uname -r)/extra/dsplinkk.ko

Please advice to run all the program automatically without using serial port and any user input.

Thanks.

-Vivek


Replies (21)

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier over 2 years ago

Vivek Ponnani wrote:

Hi,

I have a custom board with
-- MityDspl-138F module (with FPGA)
-- No Ethernet port
-- UART,USB,SD CARD interface

We are using MMC card for booting linux and to copy application software files to board.

we have done following steps till date.

-- I have built VM with MityDSP Critical_Link_Unified_VM_14-04_04-2017.ova file from critical link.
-- I have successfully run the example programs.
-- I have build new kernel with Analog Expansion support. We followed https://support.criticallink.com/redmine/projects/90-000173/wiki for the build of new kernel.
-- I have prepared SD card and copy new Linux kernel and its file system. And also inserted the modules under /lib/modules/3.2.0+/extra as per the https://support.criticallink.com/redmine/projects/90-000173/wiki

Now, I want Linux kernel and FPGA image in SPI flash, Kernel Filesystem in NAND partition and application software image in NAND (userfs) partition.

Please answer my below queries.

1) Steps to program FPGA in SPI flash.

From the page https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Programming_the_FPGA

U-Boot > loadb 0xC0700000
  1. Ready for binary (kermit) download to 0xC0700000 at 115200 bps...
  2. Total Size = 0x00071544 = 464196 Bytes
  3. Start Addr = 0xC0700000

uBoot> sf probe 0
uBoot> sf erase 0x580000 0x80000
uBoot> sf write 0xC0700000 0x580000 ${filesize}

uBoot> setenv progfpga "sf probe 0; sf read 0xc0700000 0x580000 0x80000; loadfpga 0xc0700000"
uBoot> setenv bootcmd "run progfpga"

With this bootcmd, you will only load the fpga and nothing else on boot.

uBoot> saveenv

On restart every time FPGA will be programmed from the file stored in SPI flash, right?

2) Steps to load Linux kernel image to SPI flash.

U-Boot > mmcinfo
U-Boot > ext2load mmc 0:1 c0700000 /boot/uImage

u-Boot> sf probe 0
u-Boot> sf erase 0x100000 0x300000
u-Boot> sf write 0xC0700000 0x100000 0x26E3C8--> (size of uImage on MMC Card)

above command will load Linux Kernel to SPI flash, right?

Yes

3) Steps to load Linux file system in NAND (rootfs)

u-Boot> mw.b 0xC2000000 0xFF 0x06000000
u-Boot> ext2load mmc 0:1 C2000000 /media/mmcblk0p1/home/root/root_filesystem.jffs2

This path doesn't exist. /media/mmcblk0p1 is a mount in linux. /home/root/root_filesystem.jffs2 should work just fine.

u-Boot> nand erase 0 0x8000000
u-Boot> nand write.jffs2 0xC2000000 0 0x05188000 --> (calculated size of .jffs2 file)

above command will load Linux File system to NAND flash, right?

Yes

4) Auto load kernel from SPI flash and file system from the NAND on power on.

U-Boot> setenv bootcmd "sf probe 0; sf read 0xc0700000 0x100000 0x300000;setenv bootargs mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw noatime rootfstype=jffs2 ip=off;bootm 0xc0700000"

U-Boot> saveenv

on restart,load kernel and filesystem from SPI flash and NAND Flash respectively and run automatically, right?

Yes, though you've now overridden your fpga load. You need to add sf read 0xc0700000 0x580000 0x80000; loadfpga 0xc0700000; back in after the sf probe.

As currently, we are using MMC card to boot linux, we setup environment with below command.We have connected serial port and giving commands from teraterm.

U-Boot > setenv bootargs mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mmcblk0p1 rw rootwait ip=off
U-Boot > ext2load mmc 0:1 c0700000 /boot/uImage
[...]

5) In the above response, when the boot process reaches to line

Started Getty on tty1 [ OK ]

we have to press any key to continue boot process , otherwise its waiting there for infinite time.As we are planning to run the system automatically without any user input, What is the solution for this problem?

That should be the end of the boot process. What do you expect to happen after this?

6) The screen Prompts for mityomapl138 login:. We enter root login and it gives root@mityomapl138:~#. Then we give following commands to run our application. TestAdcDacRtARM and TestAdcDacRtDSP.out are our application generated file for ARM and DSP respectively.

root@mityomapl138:~# mount
root@mityomapl138:~# cp /media/mmcblk0p1/home/root/TestAdcDacRtARM /tmp/
root@mityomapl138:~# cp /media/mmcblk0p1/home/root/TestAdcDacRtDSP.out /tmp/

This path /media/mmcblk0p1/home/root/TestAdcDacRtARM is the same as /home/root/TestAdcDacRtARM.
Why do you copy these files to temp?

root@mityomapl138:~# insmod /lib/modules/$(uname -r)/extra/dsplinkk.ko
DSPLINK Module (1.65.00.03) created on Date: Jan 13 2014 Time: 16:10:29
root@mityomapl138:~# ./TestAdcDacRtARM TestAdcDacRtDSP.out

You are running them from /home/root/ here.

For auto run of application from the flash ,we can not enter mityomapl138 login:. could you please explain how to do above process in auto run of application with example?

You need to create a bash script which calls those commands. And then you can use systemd to run the script on boot.
https://www.devdungeon.com/content/creating-systemd-service-files

bash script "start_application.sh"

#!/bin/sh

insmod /lib/modules/$(uname -r)/extra/dsplinkk.ko
./TestAdcDacRtARM TestAdcDacRtDSP.out

As per my understanding I can write my application generated files to NAND flash with nand write command on uBoot prompt and read at RAM location with nand read command on uBoot prompt. Then How should I put command to auto run my application files from that RAM location?

The ARM application you have written requires linux to be running so you can't launch it from u-boot. Similarly the dsp application is likely relying on dsplink which also requires linux.

6) which command I need to auto run below command to insert dsplink file?

root@mityomapl138:~# insmod /lib/modules/$(uname -r)/extra/dsplinkk.ko

You would run this command from your bash script on boot. See above comment.

Please advice to run all the program automatically without using serial port and any user input.

Thanks.

-Vivek

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani over 2 years ago

Thanks for your response. It is very helpful.

Most of the points are cleared. I have further queries as below.

1) I am not much familiar with linux.I tried to create AutoRun.service file in /etc/systemd/system folder as per the link https://www.devdungeon.com/content/creating-systemd-service-files. please take a look and suggest if any changes required. I belive this .service file will be called automatically after end of boot process. Or we have to do something to call it after boot process?

AutoRun.service file is as below.

[Unit]
Description=Application run
After=network.target

[Service]
WorkingDirectory=/home/root
ExecStart=/bin/start_application.sh
Restart=always

[Install]
WantedBy=multi-user.target

2) In which folder I have to create start_application.sh? As in bin folder, create document is not allowed. According to start_application.sh path I have to change the path in ExecStart of AutoRun.service file?

3) once I copy the TestAdcDacRtARM (Arm application) and TestAdcDacRtDsp.out to NAND flash (in memory region from 0x8000000 to 0xFFFFFFF defined as (userfs) in setenv command) with nand write command, and run
./TestAdcDacRtARM TestAdcDacRtDSP.out
from the start_application.sh.
Will it run directly from that NAND flash memory location or I have to copy that files to RAM (DDR2)?
Or there is some another process to load application files (TestAdcDacRtARM and TestAdcDacRtDsp.out) on the board?

4) I belive once we load all the required programs in SPI Flash and NAND flash, then after uBoot it will count down from 3 to 0 as bootdelay =3. If we want to load any program again in flash after uBoot, we have to hit any key between count 3 to 0, is that correct?

Thanks
-Vivek.

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier over 2 years ago

Vivek Ponnani wrote:

Thanks for your response. It is very helpful.

Most of the points are cleared. I have further queries as below.

1) I am not much familiar with linux.I tried to create AutoRun.service file in /etc/systemd/system folder as per the link https://www.devdungeon.com/content/creating-systemd-service-files. please take a look and suggest if any changes required. I belive this .service file will be called automatically after end of boot process. Or we have to do something to call it after boot process?

AutoRun.service file is as below.

[Unit]
Description=Application run
After=network.target

[Service]
WorkingDirectory=/home/root
ExecStart=/bin/start_application.sh
Restart=always

[Install]
WantedBy=multi-user.target

Your missing type=simple.

[Unit]
Description=Application run
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/root
ExecStart=/bin/start_application.sh
Restart=always

[Install]
WantedBy=multi-user.target

  • Then you'll want to reload the systemd daemon
    systemctl daemon-reload
  • Test your service
    systemctl start AutoRun.service
    systemctl status AutoRun.service
    The status command should report that the service is running.
  • And enable the service so it starts on boot
    systemctl enable AutoRun.service
  • Reboot and verify that the service started
    reboot
    systemctl status AutoRun.service

2) In which folder I have to create start_application.sh?

You can put it pretty much any place. /bin would be okay. Though we usually put them in /home/root/ so that all the files are in one place.

As in bin folder, create document is not allowed.

I'm not sure what you mean.

According to start_application.sh path I have to change the path in ExecStart of AutoRun.service file?

Yes the ExecStart= should point to where you place the start_application.sh file.

3) once I copy the TestAdcDacRtARM (Arm application) and TestAdcDacRtDsp.out to NAND flash (in memory region from 0x8000000 to 0xFFFFFFF defined as (userfs) in setenv command) with nand write command, and run
./TestAdcDacRtARM TestAdcDacRtDSP.out
from the start_application.sh.
Will it run directly from that NAND flash memory location or I have to copy that files to RAM (DDR2)?

Okay so we don't want or need to write these files directly to the nand. We want them stored on a filesystem so they can be easily read by linux. Generally during development if we boot from the nand we copy the programs over the ethernet. Since you don't have that I'd suggest copying them from mmc or from a usb flash drive.

There is no need to manually copy your program to ram if its stored in the filesystem. It will simply appear as a file and can be executed normally.

Or there is some another process to load application files (TestAdcDacRtARM and TestAdcDacRtDsp.out) on the board?

Tweaking your code from before, this will copy the files from the mmc /home/root to the nand /home/root.

root@mityomapl138:~# cp /media/mmcblk0p1/home/root/TestAdcDacRtARM /home/root/
root@mityomapl138:~# cp /media/mmcblk0p1/home/root/TestAdcDacRtDSP.out /home/root/

4) I belive once we load all the required programs in SPI Flash and NAND flash, then after uBoot it will count down from 3 to 0 as bootdelay =3. If we want to load any program again in flash after uBoot, we have to hit any key between count 3 to 0, is that correct?

Yes, you can break into u-boot by pressing any key during this window of time.

Thanks
-Vivek.

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani over 2 years ago

Jonathan Cormier wrote:

Vivek Ponnani wrote:

Thanks for your response. It is very helpful.

Most of the points are cleared. I have further queries as below.

1) I am not much familiar with linux.I tried to create AutoRun.service file in /etc/systemd/system folder as per the link https://www.devdungeon.com/content/creating-systemd-service-files. please take a look and suggest if any changes required. I belive this .service file will be called automatically after end of boot process. Or we have to do something to call it after boot process?

AutoRun.service file is as below.

[Unit]
Description=Application run
After=network.target

[Service]
WorkingDirectory=/home/root
ExecStart=/bin/start_application.sh
Restart=always

[Install]
WantedBy=multi-user.target

Your missing type=simple.
[...]

  • Then you'll want to reload the systemd daemon
    systemctl daemon-reload
  • Test your service
    systemctl start AutoRun.service
    systemctl status AutoRun.service
    The status command should report that the service is running.
  • And enable the service so it starts on boot
    systemctl enable AutoRun.service
  • Reboot and verify that the service started
    reboot
    systemctl status AutoRun.service

could you please explain where (on board or VM) and when (if command execution is on board)to give all this systemctl commands? I have created AutoRun.service file in the folder from where I will generate .jffs2 file for linux filesytem.

2) In which folder I have to create start_application.sh?

You can put it pretty much any place. /bin would be okay. Though we usually put them in /home/root/ so that all the files are in one place.

As in bin folder, create document is not allowed.

I'm not sure what you mean.

According to start_application.sh path I have to change the path in ExecStart of AutoRun.service file?

Yes the ExecStart= should point to where you place the start_application.sh file.

3) once I copy the TestAdcDacRtARM (Arm application) and TestAdcDacRtDsp.out to NAND flash (in memory region from 0x8000000 to 0xFFFFFFF defined as (userfs) in setenv command) with nand write command, and run
./TestAdcDacRtARM TestAdcDacRtDSP.out
from the start_application.sh.
Will it run directly from that NAND flash memory location or I have to copy that files to RAM (DDR2)?

Okay so we don't want or need to write these files directly to the nand. We want them stored on a filesystem so they can be easily read by linux. Generally during development if we boot from the nand we copy the programs over the ethernet. Since you don't have that I'd suggest copying them from mmc or from a usb flash drive.

There is no need to manually copy your program to ram if its stored in the filesystem. It will simply appear as a file and can be executed normally.

Or there is some another process to load application files (TestAdcDacRtARM and TestAdcDacRtDsp.out) on the board?

Tweaking your code from before, this will copy the files from the mmc /home/root to the nand /home/root.
[...]

4) I belive once we load all the required programs in SPI Flash and NAND flash, then after uBoot it will count down from 3 to 0 as bootdelay =3. If we want to load any program again in flash after uBoot, we have to hit any key between count 3 to 0, is that correct?

Yes, you can break into u-boot by pressing any key during this window of time.

Thanks
-Vivek.

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier over 2 years ago

Vivek Ponnani wrote:

Jonathan Cormier wrote:

Vivek Ponnani wrote:

Thanks for your response. It is very helpful.

Most of the points are cleared. I have further queries as below.

1) I am not much familiar with linux.I tried to create AutoRun.service file in /etc/systemd/system folder as per the link https://www.devdungeon.com/content/creating-systemd-service-files. please take a look and suggest if any changes required. I belive this .service file will be called automatically after end of boot process. Or we have to do something to call it after boot process?

AutoRun.service file is as below.

[Unit]
Description=Application run
After=network.target

[Service]
WorkingDirectory=/home/root
ExecStart=/bin/start_application.sh
Restart=always

[Install]
WantedBy=multi-user.target

Your missing type=simple.
[...]

  • Then you'll want to reload the systemd daemon
    systemctl daemon-reload
  • Test your service
    systemctl start AutoRun.service
    systemctl status AutoRun.service
    The status command should report that the service is running.
  • And enable the service so it starts on boot
    systemctl enable AutoRun.service
  • Reboot and verify that the service started
    reboot
    systemctl status AutoRun.service

could you please explain where (on board or VM) and when (if command execution is on board)to give all this systemctl commands? I have created AutoRun.service file in the folder from where I will generate .jffs2 file for linux filesytem.

All of these commands were assuming you were booted and running on the l138.

Alright so assuming your trying to customize the MDK mityomap-full.tgz filesystem. We extract the filesystem, copy your application files to home/root. Copy your systemd service file to etc/systemd/system and create the symlink which will "enable" the service.

jcormier@jcormier-desktop:~/MDK_2014-01-13/fs$ ls
mityomap-base.jffs2  mityomap-base.tgz  mityomap-full.jffs2  mityomap-full.tgz
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs$ mkdir mityomap-full
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs$ cd mityomap-full
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs/mityomap-full$ sudo tar xzf ../mityomap-full.tgz 
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs/mityomap-full$ ls
bin  boot  dev  etc  home  lib  media  mnt  proc  run  sbin  sys  tmp  usr  var
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs/mityomap-full$ sudo cp <PATH>/TestAdcDacRtARM <PATH>/TestAdcDacRtDsp.out <PATH>/start_application.sh home/root/
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs/mityomap-full$ sudo cp ~/AutoRun.service etc/systemd/system/
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs/mityomap-full$ sudo ln -s /etc/systemd/system/AutoRun.service etc/systemd/system/multi-user.target.wants/
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs/mityomap-full$ sudo ls -la etc/systemd/system/multi-user.target.wants/
total 12
drwxr-sr-x 1 root root 100 Jan 24 14:36 ./
drwx--S--- 1 root root 240 Aug  9  2012 ../
lrwxrwxrwx 1 root root  35 Jan 24 14:36 AutoRun.service -> /etc/systemd/system/AutoRun.service
lrwxrwxrwx 1 root root  39 Jan 13  2014 dropbearkey.service -> /lib/systemd/system/dropbearkey.service
lrwxrwxrwx 1 root root  36 Jan 13  2014 remote-fs.target -> /lib/systemd/system/remote-fs.target
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs/mityomap-full$ sudo tar czf ../mityomap-full-Vivek-20180124.tgz *
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs$ sudo mkfs.jffs2 -x lzo --root=mityomap-full/ --faketime --output=mityomap-full-Vivek-20180124.jffs2 --little-endian --eraseblock=0x20000 -n
jcormier@jcormier-desktop:~/MDK_2014-01-13/fs$ ls
mityomap-base.jffs2  mityomap-full.jffs2                 mityomap-full-Vivek-20180124.tgz
mityomap-base.tgz    mityomap-full.tgz
mityomap-full        mityomap-full-Vivek-20180124.jffs2

I recommend once you've verified your customized image works to take the .jffs2 and .tgz files and commit them to revision control or similar.

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani over 2 years ago

I followed the suggestions and tried to boot from flash. But It still does not run application automatically. Below is my setup on the board.

1) environment setting on board.

U-Boot > printenv
bootdelay=3
baudrate=115200
bootfile="uImage"
flashuboot=tftp 0xc0700000 mityomap/u-boot-ubl.bin; sf probe 0; sf erase 0x10000 0x80000; sf write 0xc0700000 0x10000 ${filesize}
flashkernel=tftp 0xc0700000 mityomap/uImage; sf probe 0; sf erase 0x100000 0x280000; sf write 0xc0700000 0x100000 ${filesize}
flashubl=tftp 0xc0700000 mityomap/UBL_SPI_MEM.ais; sf probe 0; sf erase 0 0x10000; sf write 0xc0700000 0 0x10000
flashrootfs=tftp 0xc2000000 mityomap/mityomap-base-mityomapl138.jffs2; nand erase 0 0x08000000; nand write.jffs2 0xc2000000 0 ${filesize}
serverip=10.0.0.23
autoload=no
mtdids=nand0=nand
mtdparts=mtdparts=nand:128M(rootfs),-(userfs)
bootargsbase=mem=96M console=ttyS1,115200n8
flashargs=setenv bootargs ${bootargsbase} ${mtdparts} root=/dev/mtdblock0 rw,noatime rootfstype=jffs2
filesize=71544
programfpga=sf probe 0;sf read 0xc0700000 0x580000 0x80000; loadfpga 0xc0700000
stdin=serial
stdout=serial
stderr=serial
ethaddr=40:d8:55:17:c8:1c
ver=U-Boot 2009.11-00002-gc6adda5 (May 01 2015 - 11:42:37)
bootcmd=run programfpga;sf read 0xc0700000 0x100000 0x300000;bootm 0xc0700000
bootargs=mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw, noatime rootfstype=jffs2 ip=off

Environment size: 1226/65532 bytes
U-Boot > saveenv
Saving Environment to SPI Flash...
Erasing SPI flash...Writing to SPI flash...done

2) FPGA write in SPI Flash

8192 KiB M25P64 at 0:0 is now current device
U-Boot > sf erase 0x580000 0x80000
U-Boot > sf write 0xC0700000 0x580000 0x00071544
U-Boot > setenv programfpga "sf probe 0;sf read 0xc0700000 0x580000 0x80000; loadfpga 0xc0700000"
U-Boot > setenv bootcmd "run programfpga"
U-Boot > saveenv
Saving Environment to SPI Flash...
Erasing SPI flash...Writing to SPI flash...done

3)Kernel write in SPI flash and filesystem in NAND.

U-Boot > ext2load mmc 0:1 c0700000 /boot/uImage
Loading file "/boot/uImage" from mmc device 0:1 (xxa1)
2548680 bytes read
U-Boot > sf probe 0
8192 KiB M25P64 at 0:0 is now current device
U-Boot > sf erase 0x100000 0x300000
U-Boot > sf write 0xC0700000 0x100000 0x26E3C8
U-Boot > mw.b 0xC2000000 0xFF 0x06000000
U-Boot > ext2load mmc 0:1 0xC2000000 /home/root/mityomap-full-custom.jffs2
Loading file "/home/root/mityomap-full-custom.jffs2" from mmc device 0:1 (xxa1)
86608080 bytes read
U-Boot > nand erase 0 0x8000000

NAND erase: device 0 offset 0x0, size 0x8000000
Bad block table found at page 131008, version 0x01
Bad block table found at page 130944, version 0x01
Erasing at 0x7fe0000 -- 100% complete.
OK
U-Boot > nand write.jffs2 0xC2000000 0 0x5299000

NAND write: device 0 offset 0x0, size 0x5299000
86609920 bytes written: OK

4) Response on board restart after all setting done..

U-Boot > OMAP-L138/AM-1808/AM-1810 initialization passed!
Configuring 128MB mDDR
Booting TI User Boot Loader
UBL Version: 1.65:2.28.1 BuiltJul 11 2011 12:49:53
UBL Flashtype: SPI
Starting SPI Memory Copy...
Valid magicnum, 0x55424CBB, found at offset 0x00010000.
DONE
Jumping to entry point at 0xC1080000.

U-Boot 2009.11-00002-gc6adda5 (May 01 2015 - 11:42:37)

I2C: ready
DRAM: 128 MB
NAND: 256 MiB
MMC: davinci: 0
In: serial
Out: serial
Err: serial
ARM Clock : 300000000 Hz
DDR Clock : 150000000 Hz
EMIFA CLock : 100000000 Hz
DSP Clock : 300000000 Hz
ASYNC3 Clock : 150000000 Hz
Enet config : 2
MMC 0 Enable : 1
Resetting ethernet phy
Net: No ETH PHY detected!!!

Hit any key to stop autoboot: 0
8192 KiB M25P64 at 0:0 is now current device
Loading FPGA from 0xC0700000 with 0x80000 bytes
Loading FPGA done
  1. Booting kernel from Legacy Image at c0700000 ...
    Image Name: Linux-3.2.0+
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 2548616 Bytes = 2.4 MB
    Load Address: c0008000
    Entry Point: c0008000
    Verifying Checksum ... OK
    Loading Kernel Image ... OK
    OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 3.2.0+ (mitydsp@vagrantup) (gcc version 4.5.4 20120305 (prerelease) (GCC) ) #1 PREEMPT Tue Jul 11 06:29:07 EDT 2017
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: MityDSP-L138/MityARM-1808
Ignoring unrecognised tag 0x42000101
Memory policy: ECC disabled, Data cache writethrough
DaVinci da850/omap-l138/am18x variant 0x1
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 24384
Kernel command line: mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw, noatime rootfstype=jffs2 ip=off
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 96MB = 96MB total
Memory: 91328k/91328k available, 6976k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc6800000 - 0xfea00000 ( 898 MB)
lowmem : 0xc0000000 - 0xc6000000 ( 96 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc0536834 (5307 kB)
.init : 0xc0537000 - 0xc0560000 ( 164 kB)
.data : 0xc0560000 - 0xc05c00c0 ( 385 kB)
.bss : 0xc05c00e4 - 0xc05ecaf0 ( 179 kB)
NR_IRQS:245
Console: colour dummy device 80x30
Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
DaVinci: 144 gpio irqs
print_constraints: dummy:
NET: Registered protocol family 16
baseboard_pre_init: Entered
mityomapl138_setup_nand: using 8 bit data
baseboard_init [IndustrialIO]...
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
print_constraints: VDCDC1: 1150 <--> 1350 mV at 1200 mV
print_constraints: VDCDC2: 1800 mV
print_constraints: VDCDC3: 1200 mV
print_constraints: LDO1: 1800 mV
print_constraints: LDO2: 2500 <--> 3300 mV at 3300 mV
Advanced Linux Sound Architecture Driver Version 1.0.24.
Switching to clocksource timer0_1
musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
Waiting for USB PHY clock good...
musb-hdrc musb-hdrc: USB OTG mode controller at fee00000 using PIO, IRQ 58
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 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.
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 178
io scheduler noop registered (default)
start plist test
end plist test
Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a 16550A
serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a 16550A
console [ttyS1] enabled
serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a 16550A
brd: module loaded
at24 1-0050: 256 byte 24c02 EEPROM, read-only, 0 bytes/write
MityOMAPL138: Found MAC = 40:d8:55:17:c8:1c
MityOMAPL138: Part Number = L138-FG-225-RC
ONFI flash detected
ONFI param page 0 valid
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08ABAEAWP)
Bad block table found at page 131008, version 0x01
Bad block table found at page 130944, version 0x01
Creating 2 MTD partitions on "davinci_nand.1":
0x000000000000-0x000008000000 : "rootfs"
0x000008000000-0x000010000000 : "homefs"
davinci_nand davinci_nand.1: controller rev. 2.5
spi_davinci spi_davinci.1: DMA: supported
spi_davinci spi_davinci.1: DMA: RX channel: 18, TX channel: 19, event queue: 0
m25p80 spi1.0: m25p64-nonjedec (8192 Kbytes)
Creating 8 MTD partitions on "m25p80":
0x000000000000-0x000000010000 : "ubl"
0x000000010000-0x000000090000 : "u-boot"
0x000000090000-0x0000000a0000 : "u-boot-env"
0x0000000a0000-0x0000000b0000 : "periph-config"
No LCD configured
MII PHY configured
0x0000000b0000-0x000000100000 : "reserved"
0x000000100000-0x000000400000 : "kernel"
0x000000400000-0x000000600000 : "fpga"
0x000000600000-0x000000800000 : "spare"
spi_davinci spi_davinci.1: Controller at 0xfef0e000
CAN device driver interface
mcp251x spi1.1: MCP251x didn't enter in conf mode after reset
mcp251x spi1.1: Probe failed
mcp251x spi1.1: probe failed
davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
davinci_mdio davinci_mdio.0: no live phy, scanning all
davinci_mdio: probe of davinci_mdio.0 failed with error -5
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci ohci.0: DA8xx OHCI
ohci ohci.0: new USB bus registered, assigned bus number 1
Waiting for USB PHY clock good...
ohci ohci.0: irq 59, io mem 0x01e25000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
omap_rtc: RTC power up reset detected
i2c /dev entries driver
cpuidle: using governor ladder
cpuidle: using governor menu
davinci_mmc davinci_mmc.0: Using DMA, 4-bit mode
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
dsd1791 spi1.2: Failed to add route LLOUT->Line Out
asoc: dsd1791 <-> davinci-mcasp.0 mapping ok
ALSA device list:
#0: MityDSP-L138 INDIO
TCP cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20090105 abi 8)
NET: Registered protocol family 29
can: raw protocol (rev 20090105)
regulator_init_complete: LDO2: incomplete constraints, leaving on
regulator_init_complete: LDO1: incomplete constraints, leaving on
regulator_init_complete: VDCDC3: incomplete constraints, leaving on
regulator_init_complete: VDCDC2: incomplete constraints, leaving on
regulator_init_complete: VDCDC1: incomplete constraints, leaving on
console [netcon0] enabled
netconsole: network logging started
mmc0: new SDHC card at address 8eeb
omap_rtc omap_rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
mmcblk0: mmc0:8eeb SD04G 3.69 GiB
mmcblk0: p1
VFS: Mounted root (jffs2 filesystem) on device 31:0.
devtmpfs: mounted
Freeing init memory: 164K
Failed to mount /sys/kernel/security: No such file or directory

Welcome to The Ångström Distribution!

NET: Registered protocol family 10
Starting LSB: The RPC portmapper...
Starting Load Kernel Modules...
Started Set Up Additional Binary Formats [ OK ]
Starting Apply Kernel Variables...
Starting Debug File System...
Started Huge Pages File System [ OK ]
Starting POSIX Message Queue File System...
Starting File System Check on Root Device...
Starting Remount API VFS...
Starting Temporary Directory...
Starting udev Coldplug all Devices...
Starting udev Kernel Device Manager...
Starting Journal Service...
Started Journal Service [ OK ]
Started Load Kernel Modules [ OK ]
Started Apply Kernel Variables [ OK ]
Started File System Check on Root Device [ OK ]
Starting Remount Root FS...
Started Configuration File System [ OK ]
Started FUSE Control File System [ OK ]
Started Debug File System [ OK ]
Started POSIX Message Queue File System [ OK ]
Started Remount API VFS [ OK ]
Started Temporary Directory [ OK ]
udevd1090: starting version 182
Started udev Kernel Device Manager [ OK ]
Started Remount Root FS [ OK ]
Starting Recreate Volatile Files and Directories...
Starting Load Random Seed...
Started Machine ID first boot configure [ OK ]
Starting Run pending postinsts...
Started Load Random Seed [ OK ]
Started LSB: The RPC portmapper [ OK ]
Started Recreate Volatile Files and Directories [ OK ]
portmap1079: Starting portmap daemon...
EXT3-fs (mmcblk0): error: can't find ext3 filesystem on dev mmcblk0.
EXT2-fs (mmcblk0): error: can't find an ext2 filesystem on dev mmcblk0.
FAT-fs (mmcblk0): bogus number of reserved sectors
FAT-fs (mmcblk0): Can't find a valid FAT filesystem
VFS: Can't find a Minix filesystem V1 | V2 | V3 on device mmcblk0.
cramfs: wrong magic
FAT-fs (mmcblk0): bogus number of reserved sectors
FAT-fs (mmcblk0): Can't find a valid FAT filesystem
Started udev Coldplug all Devices [ OK ]
kjournald starting. Commit interval 5 seconds
EXT3-fs (mmcblk0p1): using internal journal
EXT3-fs (mmcblk0p1): 1 orphan inode deleted
EXT3-fs (mmcblk0p1): recovery complete
EXT3-fs (mmcblk0p1): mounted filesystem with writeback data mode
Disabling lock debugging due to kernel taint
DSPLINK Module (1.65.00.03) created on Date: Jan 13 2014 Time: 16:10:29
PHY 0:03 not found
net eth0: could not connect to phy 0:03
ADDRCONF: eth0: link is not ready

.---O---. | | .-. o o | | |-----.-----.-----.| | .----..-----.-----. | | | __ | ---'| '--.| .-'| | | | | | | | |--- || --'| | | ' | | | |
'---'---'--'--'--. |-----''----''--' '-----'-'-'-'
' |
'--
'

The Angstrom Distribution mityomapl138 ttyS1

Angstrom v2012.05 - Kernel 3.2.0+

mityomapl138 login:

Why it is looking for ext3 file system and asking for login? I am expecting to run system as I have start_application.sh in /home/boot folder and AutoRun.service in /etc/systemd/system. Is there any setting which I have missed? should I remove memory card from board while booting from flash? Please suggest.

5) Below is the setting for config set on uBoot, when we use MMC card for booting the system.

U-Boot > config set
Ethernet Config : 2 (make it 0 for Ethernet port)
UART - 0 Configuration ---
Enable UART : 0
UART - 1 Configuration ---
Enable UART : 1
Baud : 115200
HW Flow Control : 0
Is Console : 1
UART - 2 Configuration ---
Enable UART : 0
SPI - 0 Configuration ---
Enable SPI : 0
SPI - 1 Configuration ---
Enable SPI : 1
CLK is Output : 1
Chip Select [0] Enable : 01
Chip Select [1] Enable : 00
Chip Select [2] Enable : 00
Chip Select [3] Enable : 00
Chip Select [4] Enable : 00
Chip Select [5] Enable : 00
Chip Select [6] Enable : 00
Chip Select [7] Enable : 00
ENA ENable : 0
CLK Rate : 30000000
LCD Configuration
LCD Enable : 1
Panel Name : wvga_800x480
MMC 0 Configuration
MMC 0 Enable : 1
Write Protect Pin bank : 4
Write Protect Pin bank offset : 1
Card Detect Pin bank : 4
Card Detect Pin bank offset : 0
U-Boot > config save

We need to change any setting in above configuration when we boot from SPI flash?

Thanks.
Vivek.

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier over 2 years ago

Vivek Ponnani wrote:

I followed the suggestions and tried to boot from flash. But It still does not run application automatically. Below is my setup on the board.

What does your application do? How do you know its running?

1) environment setting on board.

bootargs=mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw, noatime rootfstype=jffs2 ip=off

There should not be a comma after rw. This isn't breaking anything though.

2) FPGA write in SPI Flash
U-Boot > setenv bootcmd "run programfpga"

You appear to have set bootcmd to "bootcmd=run programfpga;sf read 0xc0700000 0x100000 0x300000;bootm 0xc0700000" but its not in your log.

3)Kernel write in SPI flash and filesystem in NAND.

Looks good

4) Response on board restart after all setting done..

Kernel command line: mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw, noatime rootfstype=jffs2 ip=off

root= is set to the nand device so we are booting from nand not sdcard.

EXT3-fs (mmcblk0): error: can't find ext3 filesystem on dev mmcblk0.
EXT2-fs (mmcblk0): error: can't find an ext2 filesystem on dev mmcblk0.
FAT-fs (mmcblk0): bogus number of reserved sectors
FAT-fs (mmcblk0): Can't find a valid FAT filesystem
VFS: Can't find a Minix filesystem V1 | V2 | V3 on device mmcblk0.
cramfs: wrong magic
FAT-fs (mmcblk0): bogus number of reserved sectors
FAT-fs (mmcblk0): Can't find a valid FAT filesystem

The system is trying to mount the bare mmc device so its failing each of the types its trying. This isn't a problem.

Started udev Coldplug all Devices [ OK ]
kjournald starting. Commit interval 5 seconds
EXT3-fs (mmcblk0p1): using internal journal
EXT3-fs (mmcblk0p1): 1 orphan inode deleted
EXT3-fs (mmcblk0p1): recovery complete
EXT3-fs (mmcblk0p1): mounted filesystem with writeback data mode

It finally found a filesystem on partition 1 of the mmc. Still not a problem.

Why it is looking for ext3 file system

One of the boot scripts is setup to look for and try to mount the sd card. This shouldn't be a problem.

and asking for login?

Getty is setup to start on boot, its job is to ask for a login. This seems normal and fine to me. Is your application supposed to interact with the debug console?

I am expecting to run system as I have start_application.sh in /home/boot folder and AutoRun.service in /etc/systemd/system. Is there any setting which I have missed?

Login and check to see if the files you added are there.
Post the results for the following.

ls -la /home/root/
ls -la /etc/systemd/system/*
# Test your service
systemctl start AutoRun.service
systemctl status AutoRun.service
# The status command should report that the service is running.
# And enable the service so it starts on boot
systemctl enable AutoRun.service

should I remove memory card from board while booting from flash? Please suggest.

Shouldn't matter.

5) Below is the setting for config set on uBoot, when we use MMC card for booting the system.

We need to change any setting in above configuration when we boot from SPI flash?

Nope you are booting from nand just fine.

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani over 2 years ago

Jonathan Cormier wrote:

Vivek Ponnani wrote:

I followed the suggestions and tried to boot from flash. But It still does not run application automatically. Below is my setup on the board.

What does your application do? How do you know its running?

--Our application does demodulation. At the start of the application we should get following debug on teraterm.

root@mityomapl138:~# ./DigitalDemodulatorARM DigitalDemodulatorDSP.out
spi mode: 0
bits per word: 8
max speed: 10000000 Hz (10000 KHz)
Creating DSPApp object.
Loading file DigitalDemodulatorDSP.out
PROC Load successful
Starting application.
DSP Initialization finished."
Sending a message to the DSP to start receive.
Waiting for DSP response (type 'q' to quit)...
[DSP] getting instance of DSPuPP
[DSP] configuring UPP
[DSP] upp configured

1) environment setting on board.

bootargs=mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw, noatime rootfstype=jffs2 ip=off

There should not be a comma after rw. This isn't breaking anything though.

-- ok
2) FPGA write in SPI Flash
U-Boot > setenv bootcmd "run programfpga"

You appear to have set bootcmd to "bootcmd=run programfpga;sf read 0xc0700000 0x100000 0x300000;bootm 0xc0700000" but its not in your log.

--Actully bootcmd is in printenv command (1st point). I did it after FPGA write in flash.. by mistake I mentioned in 1st point. It should be last point.

In FPGA programming, I believe as soon as FPGA programming done with above command ,the FPGA done LED should be illuminated and FPGA should start running. But No LED illuminated after above commands whereas when we program FPGA with JTAG it works.

3)Kernel write in SPI flash and filesystem in NAND.

Looks good

--ok
4) Response on board restart after all setting done..

Kernel command line: mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw, noatime rootfstype=jffs2 ip=off

root= is set to the nand device so we are booting from nand not sdcard.

-- yes we want to boot from NAND ony.

EXT3-fs (mmcblk0): error: can't find ext3 filesystem on dev mmcblk0.
EXT2-fs (mmcblk0): error: can't find an ext2 filesystem on dev mmcblk0.
FAT-fs (mmcblk0): bogus number of reserved sectors
FAT-fs (mmcblk0): Can't find a valid FAT filesystem
VFS: Can't find a Minix filesystem V1 | V2 | V3 on device mmcblk0.
cramfs: wrong magic
FAT-fs (mmcblk0): bogus number of reserved sectors
FAT-fs (mmcblk0): Can't find a valid FAT filesystem

The system is trying to mount the bare mmc device so its failing each of the types its trying. This isn't a problem.

Started udev Coldplug all Devices [ OK ]
kjournald starting. Commit interval 5 seconds
EXT3-fs (mmcblk0p1): using internal journal
EXT3-fs (mmcblk0p1): 1 orphan inode deleted
EXT3-fs (mmcblk0p1): recovery complete
EXT3-fs (mmcblk0p1): mounted filesystem with writeback data mode

It finally found a filesystem on partition 1 of the mmc. Still not a problem.

Why it is looking for ext3 file system

One of the boot scripts is setup to look for and try to mount the sd card. This shouldn't be a problem.

and asking for login?

Getty is setup to start on boot, its job is to ask for a login. This seems normal and fine to me. Is your application supposed to interact with the debug console?

--No,our application is not supposed to interact with the debug console. We don't want any connection with any host system. We want that our application should start and run without any interact with the debug console. For that we want to bypass login. And also after

Started Getty on tty1 [ OK ]

we need to press any key for the login prompt on host machine which connected to board with serial port. Otherwise it wait there for infinite time. what could be the solution for it?

I am expecting to run system as I have start_application.sh in /home/boot folder and AutoRun.service in /etc/systemd/system. Is there any setting which I have missed?

Login and check to see if the files you added are there.
Post the results for the following.
[...]

--Attached Result.txt

should I remove memory card from board while booting from flash? Please suggest.

Shouldn't matter.

5) Below is the setting for config set on uBoot, when we use MMC card for booting the system.

We need to change any setting in above configuration when we boot from SPI flash?

Nope you are booting from nand just fine.

------some Observation from the debug on console highlighted with bold

portmap1099: Starting portmap daemon...
Started D-Bus System Message Bus [ OK ]
Starting Serial Getty on ttyS1...
Started Serial Getty on ttyS1 [ OK ]

.---O---. | | .-. o o | | |-----.-----.-----.| | .----..-----.-----. | | | __ | ---'| '--.| .-'| | | | | | | | |--- || --'| | | ' | | | |
'---'---'--'--'--. |-----''----''--' '-----'-'-'-'
' |
'--
'

The Angstrom Distribution mityomapl138 ttyS1

Angstrom v2012.05 - Kernel 3.2.0+

mityomapl138 login: Disabling lock debugging due to kernel taint
DSPLINK Module (1.65.00.03) created on Date: Jan 13 2014 Time: 16:10:29

EXT3-fs (mmcblk0): error: can't find ext3 filesystem on dev mmcblk0.
EXT2-fs (mmcblk0): error: can't find an ext2 filesystem on dev mmcblk0.
FAT-fs (mmcblk0): bogus number of reserved sectors
FAT-fs (mmcblk0): Can't find a valid FAT filesystem
Started udev Coldplug all Devices [ OK ]
Starting Networking...
VFS: Can't find a Minix filesystem V1 | V2 | V3 on device mmcblk0.
cramfs: wrong magic
FAT-fs (mmcblk0): bogus number of reserved sectors
FAT-fs (mmcblk0): Can't find a valid FAT filesystem
Started Restore Sound Card State [ OK ]
Started Login Service [ OK ]
Started Avahi mDNS/DNS-SD Stack [ OK ]
PHY 0:03 not found
net eth0: could not connect to phy 0:03
ADDRCONF: eth0: link is not ready
kjournald starting. Commit interval 5 seconds
EXT3-fs (mmcblk0p1): using internal journal
EXT3-fs (mmcblk0p1): mounted filesystem with writeback data mode
Started Networking [ OK ]
Starting Getty on tty1...
Started Getty on tty1 [ OK ]

.---O---. | | .-. o o | | |-----.-----.-----.| | .----..-----.-----. | | | __ | ---'| '--.| .-'| | | | | | | | |--- || --'| | | ' | | | |
'---'---'--'--'--. |-----''----''--' '-----'-'-'-'
' |
'--
'

The Angstrom Distribution mityomapl138 ttyS1

Angstrom v2012.05 - Kernel 3.2.0+

mityomapl138 login:

From the debug on the console, It seems AutoRun.service is called immediately after

Started Serial Getty on ttyS1                                          [  OK  ]

As I can see there is debug on console

Disabling lock debugging due to kernel taint
DSPLINK Module (1.65.00.03) created on Date: Jan 13 2014 Time: 16:10:29

which is for the 1st command - insmod /lib/modules/$(uname -r)/extra/dsplinkk.ko - in start_application.sh.

Then it looks for MMC card and after it stops at
Started Getty on tty1                                                  [  OK  ]
Thereafter I have to press any key and it asks for login.

Should I change After = network.target,in AutoRun.Service file to something else where actually boot process stops?

[Unit]
Description=Application run
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/root
ExecStart=/bin/start_application.sh
Restart=always

[Install]
WantedBy=multi-user.target

Thanks.
-Vivek.

Result.txt View (4.11 KB)

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier over 2 years ago

Vivek Ponnani wrote:

2) FPGA write in SPI Flash
U-Boot > setenv bootcmd "run programfpga"

You appear to have set bootcmd to "bootcmd=run programfpga;sf read 0xc0700000 0x100000 0x300000;bootm 0xc0700000" but its not in your log.

--Actully bootcmd is in printenv command (1st point). I did it after FPGA write in flash.. by mistake I mentioned in 1st point. It should be last point.

In FPGA programming, I believe as soon as FPGA programming done with above command ,the FPGA done LED should be illuminated and FPGA should start running. But No LED illuminated after above commands whereas when we program FPGA with JTAG it works.

Yes I believe the FPGA light should come on. I'm not familiar with the FPGA but if the light doesn't come on then it probably wasn't programmed with a correct image.

Kernel command line: mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw, noatime rootfstype=jffs2 ip=off

root= is set to the nand device so we are booting from nand not sdcard.

-- yes we want to boot from NAND ony.

Okay and it looks like thats working.

Getty is setup to start on boot, its job is to ask for a login. This seems normal and fine to me. Is your application supposed to interact with the debug console?

--No,our application is not supposed to interact with the debug console.

Okay I'm not sure if we are understanding each other. From your example output above, your app asks for a 'q' key to be pressed to quit. Does your app need user input?

We don't want any connection with any host system.

I'm not sure what you mean by this.

We want that our application should start and run without any interact with the debug console. For that we want to bypass login. And also after
Started Getty on tty1 [ OK ]
we need to press any key for the login prompt on host machine which connected to board with serial port. Otherwise it wait there for infinite time. what could be the solution for it?

You should not have to press any key or login. The app will run in the background. The device is finished booting when this happens.

I am expecting to run system as I have start_application.sh in /home/boot folder and AutoRun.service in /etc/systemd/system. Is there any setting which I have missed?

Login and check to see if the files you added are there.
Post the results for the following.
[...]

--Attached Result.txt

These results look good. Everything appears to be running. I'm confused about what is not working.

From the debug on the console, It seems AutoRun.service is called immediately after

Started Serial Getty on ttyS1 [ OK ]

As I can see there is debug on console

Disabling lock debugging due to kernel taint
DSPLINK Module (1.65.00.03) created on Date: Jan 13 2014 Time: 16:10:29

which is for the 1st command - insmod /lib/modules/$(uname -r)/extra/dsplinkk.ko - in start_application.sh.

Then it looks for MMC card and after it stops at

Started Getty on tty1 [ OK ]

It stops because everything has finished booting. And your application is running.

Thereafter I have to press any key and it asks for login.

Should I change After = network.target,in AutoRun.Service file to something else where actually boot process stops?

After network.target seems to work. I'm unclear what you expect to happen.

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani over 2 years ago

I was expecting following Debug response, which comes up when I run application by myself with the help of treaterm and booting off from MMC card.

root@mityomapl138:~# ./DigitalDemodulatorARM DigitalDemodulatorDSP.out

--response

spi mode: 0
bits per word: 8
max speed: 10000000 Hz (10000 KHz)
Creating DSPApp object.
Loading file DigitalDemodulatorDSP.out
PROC Load successful
Starting application.
DSP Initialization finished."
Sending a message to the DSP to start receive.
Waiting for DSP response (type 'q' to quit)...
[DSP] getting instance of DSPuPP
[DSP] configuring UPP
[DSP] upp configured

1)When application runs,there is some debug part (as above)which dsp sends to arm with dsplink. It should be there on the screen even application runs automatically on boot,right?

2) pressing q is for terminating the application. We will bypass it. But there is no need of any input to start and run the application.

Thanks
-Vivek.

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier over 2 years ago

Vivek Ponnani wrote:

1)When application runs,there is some debug part (as above)which dsp sends to arm with dsplink. It should be there on the screen even application runs automatically on boot,right?

Generally when auto running things on linux the output isn't shown on the debug console. With the .service files, any output your app sends gets captured in the journal which can be displayed by journalctl command. However we don't have a lot of experience using this tool. What we usually do is redirect program output to a log file which you can then open if you want to see what the program is doing.

So your start script would do the following which would create a log file in the home directory.

./DigitalDemodulatorARM DigitalDemodulatorDSP.out >> ~/app.log 2>&1
See the following link for details
https://www.tldp.org/LDP/abs/html/io-redirection.html

Note if you want to see live updates to the log file you can then run tail -f ~/app.log which will open the file and print new output as the file changes.

2) pressing q is for terminating the application. We will bypass it. But there is no need of any input to start and run the application.

Okay.

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani over 2 years ago

Jonathan Cormier wrote:

Vivek Ponnani wrote:

1)When application runs,there is some debug part (as above)which dsp sends to arm with dsplink. It should be there on the screen even application runs automatically on boot,right?

Generally when auto running things on linux the output isn't shown on the debug console. With the .service files, any output your app sends gets captured in the journal which can be displayed by journalctl command. However we don't have a lot of experience using this tool. What we usually do is redirect program output to a log file which you can then open if you want to see what the program is doing.

So your start script would do the following which would create a log file in the home directory.

./DigitalDemodulatorARM DigitalDemodulatorDSP.out >> ~/app.log 2>&1
See the following link for details
https://www.tldp.org/LDP/abs/html/io-redirection.html

Note if you want to see live updates to the log file you can then run tail -f ~/app.log which will open the file and print new output as the file changes.

2) pressing q is for terminating the application. We will bypass it. But there is no need of any input to start and run the application.

Okay.

Thanks a lot Jonathan. There was a problem in .bin file generation of FPGA. With the help from the FPGA forum , we are able to solve it. Now our application is running from flash. Thanks for all your support and guidance.

Apart from this, one more thing I want to understand.
Currently our application program is part of .jffs2 file system (Linux root file system + application program) in NAND (rootfs). But if we want to update only application every time in userfs part of NAND and not with .jffs2 which is part of the rootfs of NAND then what should we do?

Thanks
-Vivek.

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier over 2 years ago

Vivek Ponnani wrote:

Currently our application program is part of .jffs2 file system (Linux root file system + application program) in NAND (rootfs). But if we want to update only application every time in userfs part of NAND and not with .jffs2 which is part of the rootfs of NAND then what should we do?

I'm not sure what your requirements are for updates but I'll answer with what we normally due although there are more options.

Normally there is no need to replace the whole filesystem in order to do an update. What we've done in the past is to have the start script check for an update and if present, it will replace the needed files and then run the updated application. This update could be provided over the network or on an attached USB or sdcard.

The userfs partition is usually used if the system requires some more robustness. The root partition can be mounted read-only and then data that is collected gets stored on the read-write userfs partition. You might still store your application on the read-only partition in this case to ensure it doesn't get overwritten or corrupted, and the update process can remount the root partition read-write during the update.

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani almost 2 years ago

Jonathan Cormier wrote:

Vivek Ponnani wrote:

Jonathan Cormier wrote:

Vivek Ponnani wrote:

Thanks for your response. It is very helpful.

Most of the points are cleared. I have further queries as below.

1) I am not much familiar with linux.I tried to create AutoRun.service file in /etc/systemd/system folder as per the link https://www.devdungeon.com/content/creating-systemd-service-files. please take a look and suggest if any changes required. I belive this .service file will be called automatically after end of boot process. Or we have to do something to call it after boot process?

AutoRun.service file is as below.

[Unit]
Description=Application run
After=network.target

[Service]
WorkingDirectory=/home/root
ExecStart=/bin/start_application.sh
Restart=always

[Install]
WantedBy=multi-user.target

Your missing type=simple.
[...]

  • Then you'll want to reload the systemd daemon
    systemctl daemon-reload
  • Test your service
    systemctl start AutoRun.service
    systemctl status AutoRun.service
    The status command should report that the service is running.
  • And enable the service so it starts on boot
    systemctl enable AutoRun.service
  • Reboot and verify that the service started
    reboot
    systemctl status AutoRun.service

could you please explain where (on board or VM) and when (if command execution is on board)to give all this systemctl commands? I have created AutoRun.service file in the folder from where I will generate .jffs2 file for linux filesytem.

All of these commands were assuming you were booted and running on the l138.

Alright so assuming your trying to customize the MDK mityomap-full.tgz filesystem. We extract the filesystem, copy your application files to home/root. Copy your systemd service file to etc/systemd/system and create the symlink which will "enable" the service.
[...]
I recommend once you've verified your customized image works to take the .jffs2 and .tgz files and commit them to revision control or similar.

Hi,
As per previous disscussion, I was able to make mityomap-full-custom.tgz and mityomap-full-custom.jffs2 file and able to run it on the board. Now I want to update my application file and want to make new .jffs2 file as I have no other mechanism to upgrade my application file. For that I followed below procedure , but it is not updating my application file as when I try to run my application on board, it gives me result of previous application file. So, it seems my new .jffs2 system is not updating.

steps to make new jffs2 for application update only. My previous mityomap-full-custom.tgz file is in /home/mitydsp folder.

1)mitydsp@vagrantup:~/mkdir mityomap-full
2)mitydsp@vagrantup:~/cd mityomap-full
3)mitydsp@vagrantup:~/mityomap-full$ sudo tar xzvf /home/mitydsp/mityomap-full-custom.tgz
above command extract folders/files of mityomap-full-custom.tgz (compressed archive) file into mityomap-full folder. We need to update only application file, so take previous copy of .tgz file , unzip it.

4) to copy new generated application files to mityomap-full folder.
mitydsp@vagrantup:~$ sudo cp /home/mitydsp/DigitalDemodulatorARM /home/mitydsp/mityomap-full/home/root
mitydsp@vagrantup:~$ sudo cp /home/mitydsp/DigitalDemodulatorDSP.out /home/mitydsp/mityomap-full/home/root

5)mitydsp@vagrantup:~/mityomap-full$ sudo tar czvf ../mityomap-full-custom.tgz *
above command creates a tar(zip) archive of a subdirectory in /home/mitydsp folder

6) mitydsp@vagrantup:~$ sudo mkfs.jffs2 -x lzo --root=mityomap-full/ --faketime --output=mityomap-full-custom.jffs2 --little-endian --eraseblock=0x20000 -n
above command will create .jffs2 file to copy in the board.

7) Copy mityomap-full-custom.jffs2 from VM to SD card.
mitydsp@vagrantup:~$ sudo cp /home/mitydsp/mityomap-full-custom.jffs2 /media/mitydsp/rootfs/home/root/

on Board

- Steps to load Linux kernel image to SPI flash.

U-Boot > mmcinfo
U-Boot > ext2load mmc 0:1 c0700000 /boot/uImage

u-Boot> sf probe 0
u-Boot> sf erase 0x100000 0x300000
u-Boot> sf write 0xC0700000 0x100000 0x26E3C8--> (size of uImage on MMC Card)

- Steps to load .jffs2 to NAND flash.

u-Boot> mw.b 0xC2000000 0xFF 0x06000000
u-Boot> ext2load mmc 0:1 0xC2000000 /home/root/mityomap-full-custom.jffs2
u-Boot> nand erase 0 0x8000000
u-Boot> nand write.jffs2 0xC2000000 0 0x5299000--> (calculated size of .jffs2 file)

u-Boot>setenv bootargs mem=96M console=ttyS1,115200n8 mtdparts=nand:128M(rootfs),-(userfs) root=/dev/mtdblock0 rw, noatime rootfstype=jffs2 ip=off

uBoot> setenv programfpga "sf probe 0;sf read 0xc0700000 0x580000 0x80000; loadfpga 0xc0700000"

U-Boot> setenv bootcmd "run programfpga;sf read 0xc0700000 0x100000 0x300000;bootm 0xc0700000"

U-Boot> saveenv

If I check new mityomap-full-custom.tgz file, in /home/root folder it shows DigitialDemodulatorARM and DigitalDemodulatorDSP.out updated on VM. Still when I start the board, it runs old application.

Please suggest , If I am missing something in this process or any command is wrong?

Thanks,
Vivek.

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier almost 2 years ago

I don't see any problems with your procedure. Although you don't mention running sync or safely unmounting your sd card. I know not doing this has been a problem for me in the past.

Unrelated: Remove comma so its just "rw noatime" with space

rw, noatime

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani almost 2 years ago

Although you don't mention running sync or safely unmounting your sd card - this comment is related to virtual machine or on board?
From virtual machine, we always safely eject the card and then remove. What is running sync?
And once we copy .jffs2 file from the card to flash, we do not need the card.

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier almost 2 years ago

Vivek Ponnani wrote:

Although you don't mention running sync or safely unmounting your sd card - this comment is related to virtual machine or on board?

On the virtual machine

From virtual machine, we always safely eject the card and then remove. What is running sync?

sync is a commandline tool which causes all data to be synced to disk. It is what "Safely eject" does in the background.

And once we copy .jffs2 file from the card to flash, we do not need the card.

Correct, once you write the .jffs2 file to flash, you don't need the sdcard anymore.

I'm not sure whats going wrong. What your doing should work. Double check that you are copying the files you think you are. Possibly delete the old copies and recreate them so you can be sure they were updated/copied correctly.

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani almost 2 years ago

Jonathan Cormier wrote:

Vivek Ponnani wrote:

Although you don't mention running sync or safely unmounting your sd card - this comment is related to virtual machine or on board?

On the virtual machine

From virtual machine, we always safely eject the card and then remove. What is running sync?

sync is a commandline tool which causes all data to be synced to disk. It is what "Safely eject" does in the background.

And once we copy .jffs2 file from the card to flash, we do not need the card.

Correct, once you write the .jffs2 file to flash, you don't need the sdcard anymore.

I'm not sure whats going wrong. What your doing should work. Double check that you are copying the files you think you are. Possibly delete the old copies and recreate them so you can be sure they were updated/copied correctly.

Hi,

I rechecked the files which I wanted to copy, deleted old copies and recreate them but same result. I tried to run start_application.sh file manually on board, then it gives results as below.

root@mityomapl138:~# start_application
sh: start_application: not found
root@mityomapl138:~# ls -ls
208 -rwxr-xr-x 1 root root 213102 Jan 1 1970 DigitalDemodulatorARM
1000 -rwxr-xr-x 1 root root 1023695 Jan 1 1970 DigitalDemodulatorDSP.out
0 -rw-r--r-
1 root root 0 Jan 1 00:01 results.dat
0 -rwxr-xr-x 1 root root 112 Jan 1 1970 start_application.sh
root@mityomapl138:~# ./start_application.sh
insmod: error inserting '/lib/modules/3.2.0+/extra/dsplinkk.ko': -1 File exists
spi mode: 0
bits per word: 8
max speed: 10000000 Hz (10000 KHz)
Creating DSPApp object.
Loading file DigitalDemodulatorDSP.out
Error running MSGQ_transportOpen : 0x80008028
Starting application.
Msqg <GPPMSGQ1> open failure: 0x80008050
FAILED to CONNECT TO OUTBOUND: name: DSPMSGQ0, status: 0x8000802d
inbound:GPPMSGQ1: Status = 0x8000800b
inbound:GPPMSGQ1: Terminating

It seems, the link between ARM and DSP is not working. When everything is working the message PROC Load successful comes instead of Error running MSGQ_transportOpen : 0x80008028. But when the same program we were running from card before, it was working ok.

Thanks,
Vivek

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier almost 2 years ago

Sounds like you might have a program error.

Note: If you want to verify if the file is the same one from your VM you can calculate an md5sum. And compare.

 $ md5sum results.txt 
b248dba5974f60d376be608222f6d0af  results.txt

RE: Auto run of application file (loaded in NAND Flash) - Added by Vivek Ponnani almost 2 years ago

Hi,
Actually we disabled AutoRun.service (systemctl disable AutoRun.service) on board because we wanted to test further with new application generated files and we wanted to test it directly from MMC card. If we keep AutoRun.service enabled, it starts running the application which was stored in NAND and we were not able to access MMC card to test new generated application files.

So, I again tried to disable AutoRun.service (systemctl disable AutoRun.service) on board and directly run start_application.sh after login.

root@mityomapl138:~# systemctl disable AutoRun.service
root@mityomapl138:~# ./start_application.sh

This works perfectly ok. I mean it runs my new application file which I copied to NAND with new .jffs2 file.

Now , I enable AutoRun.service as below.

root@mityomapl138:~#systemctl daemon-reload
root@mityomapl138:~# systemctl start AutoRun.service
root@mityomapl138:~#systemctl status AutoRun.service
root@mityomapl138:~# systemctl enable AutoRun.service

Then I reboot the system. It runs program with AutoRun.service and it shows my previous application file result. And then if I run start_application.sh, it shows the result which I posted earlier in my previous post.

root@mityomapl138:~# ./start_application.sh
insmod: error inserting '/lib/modules/3.2.0+/extra/dsplinkk.ko': -1 File exists
spi mode: 0
bits per word: 8
max speed: 10000000 Hz (10000 KHz)
Creating DSPApp object.
Loading file DigitalDemodulatorDSP.out
Error running MSGQ_transportOpen : 0x80008028
Starting application.
Msqg <GPPMSGQ1> open failure: 0x80008050
FAILED to CONNECT TO OUTBOUND: name: DSPMSGQ0, status: 0x8000802d
inbound:GPPMSGQ1: Status = 0x8000800b
inbound:GPPMSGQ1: Terminating

I think because the one application is already running.

So, now my question is, the way I am enabling AutoRun.service is the correct way or I have to follow some different procedure. should I again generate .jffs2 with following procedure, which copies AutoRun.service to etc/systemd/system/ folder?

1)mitydsp@vagrantup:~/mkdir mityomap-full
2)mitydsp@vagrantup:~/cd mityomap-full
3)mitydsp@vagrantup:~/mityomap-full$ sudo tar xzvf /home/mitydsp/mityomap-full-custom.tgz
above command extract folders/files of mityomap-full-custom.tgz (compressed archive) file into mityomap-full folder. We need to update only application file, so take previous copy of .tgz file , unzip it.

4) to copy new generated application files to mityomap-full folder.
mitydsp@vagrantup:~$ sudo cp /home/mitydsp/DigitalDemodulatorARM /home/mitydsp/mityomap-full/home/root
mitydsp@vagrantup:~$ sudo cp /home/mitydsp/DigitalDemodulatorDSP.out /home/mitydsp/mityomap-full/home/root

mitydsp@vagrantup:~$sudo cp AutoRun.service etc/systemd/system/
mitydsp@vagrantup:~$ sudo ln -s /etc/systemd/system/AutoRun.service etc/systemd/system/multi-user.target.wants/
mitydsp@vagrantup:~$ sudo ls -la etc/systemd/system/multi-user.target.wants/

5)mitydsp@vagrantup:~/mityomap-full$ sudo tar czvf ../mityomap-full-custom.tgz *
above command creates a tar(zip) archive of a subdirectory in /home/mitydsp folder

6) mitydsp@vagrantup:~$ sudo mkfs.jffs2 -x lzo --root=mityomap-full/ --faketime --output=mityomap-full-custom.jffs2 --little-endian --eraseblock=0x20000 -n
above command will create .jffs2 file to copy in the board.

Because by enabling AutoRun.service it runs previous application.

Thanks,
Vivek.

RE: Auto run of application file (loaded in NAND Flash) - Added by Jonathan Cormier almost 2 years ago

Vivek Ponnani wrote:

Hi,
Actually we disabled AutoRun.service (systemctl disable AutoRun.service) on board because we wanted to test further with new application generated files and we wanted to test it directly from MMC card. If we keep AutoRun.service enabled, it starts running the application which was stored in NAND and we were not able to access MMC card to test new generated application files.

I thought your new application files were programmed to the nand?

So, I again tried to disable AutoRun.service (systemctl disable AutoRun.service) on board and directly run start_application.sh after login.

root@mityomapl138:~# systemctl disable AutoRun.service
root@mityomapl138:~# ./start_application.sh

This works perfectly ok. I mean it runs my new application file which I copied to NAND with new .jffs2 file.

ok

Now , I enable AutoRun.service as below.

root@mityomapl138:~#systemctl daemon-reload
root@mityomapl138:~# systemctl start AutoRun.service
root@mityomapl138:~#systemctl status AutoRun.service
root@mityomapl138:~# systemctl enable AutoRun.service

Then I reboot the system. It runs program with AutoRun.service and it shows my previous application file result. And then if I run start_application.sh, it shows the result which I posted earlier in my previous post.

So your saying the AutoRun service is starting your old application? Where is it finding the old application?

root@mityomapl138:~# ./start_application.sh
insmod: error inserting '/lib/modules/3.2.0+/extra/dsplinkk.ko': -1 File exists
spi mode: 0
bits per word: 8
max speed: 10000000 Hz (10000 KHz)
Creating DSPApp object.
Loading file DigitalDemodulatorDSP.out
Error running MSGQ_transportOpen : 0x80008028
Starting application.
Msqg <GPPMSGQ1> open failure: 0x80008050
FAILED to CONNECT TO OUTBOUND: name: DSPMSGQ0, status: 0x8000802d
inbound:GPPMSGQ1: Status = 0x8000800b
inbound:GPPMSGQ1: Terminating

I think because the one application is already running.

Makes sense

So, now my question is, the way I am enabling AutoRun.service is the correct way or I have to follow some different procedure. should I again generate .jffs2 with following procedure, which copies AutoRun.service to etc/systemd/system/ folder?

You said you manually disabled the service above. And then manually re-enabled it. And that it was starting the wrong application. It seems like the service is running just fine.

1)mitydsp@vagrantup:~/mkdir mityomap-full
2)mitydsp@vagrantup:~/cd mityomap-full
3)mitydsp@vagrantup:~/mityomap-full$ sudo tar xzvf /home/mitydsp/mityomap-full-custom.tgz
above command extract folders/files of mityomap-full-custom.tgz (compressed archive) file into mityomap-full folder. We need to update only application file, so take previous copy of .tgz file , unzip it.

4) to copy new generated application files to mityomap-full folder.
mitydsp@vagrantup:~$ sudo cp /home/mitydsp/DigitalDemodulatorARM /home/mitydsp/mityomap-full/home/root
mitydsp@vagrantup:~$ sudo cp /home/mitydsp/DigitalDemodulatorDSP.out /home/mitydsp/mityomap-full/home/root

mitydsp@vagrantup:~$sudo cp AutoRun.service etc/systemd/system/
mitydsp@vagrantup:~$ sudo ln -s /etc/systemd/system/AutoRun.service etc/systemd/system/multi-user.target.wants/
mitydsp@vagrantup:~$ sudo ls -la etc/systemd/system/multi-user.target.wants/

5)mitydsp@vagrantup:~/mityomap-full$ sudo tar czvf ../mityomap-full-custom.tgz *
above command creates a tar(zip) archive of a subdirectory in /home/mitydsp folder

6) mitydsp@vagrantup:~$ sudo mkfs.jffs2 -x lzo --root=mityomap-full/ --faketime --output=mityomap-full-custom.jffs2 --little-endian --eraseblock=0x20000 -n
above command will create .jffs2 file to copy in the board.

Because by enabling AutoRun.service it runs previous application.

But how can it run the old application, I thought you overwrote it?

    (1-21/21)
    Add picture from clipboard (Maximum size: 500 MB)