cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lokesh_oepl
Adventurer
Adventurer
272 Views
Registered: ‎03-12-2018

How write an OCM memory location with desired value from Bootargs or from uboot ??

Jump to solution

Hello there,

I'm working on zynq7000 zc702. I have dual cpu system with linux and baremetal on cpu0 and cpu1 respectively.

For turning on cpu1, I use to write following command before linux loads i.e.

Zynq> mw 0xFFFFFFF0 0x20000000 4

Zynq> boot

 As soon as I execute above commands, Linux starts loading and after that in some time CPU1 also gets started.

This is I'm doing manually. Is there any way I can write it in bootargs or setenv or somethings to make it happen automatic.

looking forward to get a quick response on this.

 

Thanks

Lokesh 

Lokesh J.
0 Kudos
1 Solution

Accepted Solutions
lokesh_oepl
Adventurer
Adventurer
175 Views
Registered: ‎03-12-2018

If manual startup of CPU1 can be done as follows :

As soon as board starts, press any key to stop booting Linux (It gives 5 sec to make it stop otherwise, it starts booting Linux.)

Then put following 2 commands and CPU1 will start after 15 sec, when CPU0 gets booted completely, CPU1 will start.

Zynq> mw 0xFFFFFFF0 0x20000000 4

Zynq> boot

 

Here, mw – memory write command

       0xFFFFFFF0 – OCM memory, where system looks for any address to fetch for CPu1 to take its elf file and execute.

       0x20000000 – is the address, where CPU1.elf is lying.

 

Now, for automatic CPU1 startup and need to do every board restart. We are going to store the command in on-board memory (QSPI). To set this, restart the board and press anykey to stop Linux from booting.  (It gives 5 sec to make it stop otherwise, it starts booting Linux.) When you stop it, you get a u-boot prompt i.e. “Zynq>”. Write below command in sequence correctly. If you get any error with any of the command, just restart the board and redo the commands.

Zynq> setenv default_bootcmd 'echo "HELLO WORLD"; mw 0xFFFFFFF0 0x20000000 4; md 0xFFFFFFF0 4; run uenvboot; run cp_kernel2ram && bootm ${netstart}'

Zynq> saveenv

 

Now, restart the board and you should see the following prints as follows, which tells you that everything saved correctly and will start CPU1 after CPU0 gets booted -

U-Boot 2019.01 (Jan 22 2021 - 10:10:59 +0000) Xilinx Zynq ZC702

CPU:   Zynq 7z020
Silicon: v3.1
DRAM:  ECC disabled 512 MiB
MMC:   mmc@e0100000: 0
Loading Environment from SPI Flash... SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Net:   ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
eth0: ethernet@e000b000
Hit any key to stop autoboot:  0
HELLO WORLD
fffffff0: 20000000 20000000 20000000 20000000    ... ... ... ...
Lokesh J.

View solution in original post

0 Kudos
2 Replies
lokesh_oepl
Adventurer
Adventurer
184 Views
Registered: ‎03-12-2018

Hello there,

I'm referring xapp_1078 provided by Xilinx, and in that they have a file called as rwmem.elf, with which it actually writes 0x20000000 into 0xFFFFFFF0. But when I tried to use it as it is, it gives error with MMAP i.e. unable to map the memory.

Looking forward to get a positive response on this.

Thanks,

Lokesh

 

Lokesh J.
0 Kudos
lokesh_oepl
Adventurer
Adventurer
176 Views
Registered: ‎03-12-2018

If manual startup of CPU1 can be done as follows :

As soon as board starts, press any key to stop booting Linux (It gives 5 sec to make it stop otherwise, it starts booting Linux.)

Then put following 2 commands and CPU1 will start after 15 sec, when CPU0 gets booted completely, CPU1 will start.

Zynq> mw 0xFFFFFFF0 0x20000000 4

Zynq> boot

 

Here, mw – memory write command

       0xFFFFFFF0 – OCM memory, where system looks for any address to fetch for CPu1 to take its elf file and execute.

       0x20000000 – is the address, where CPU1.elf is lying.

 

Now, for automatic CPU1 startup and need to do every board restart. We are going to store the command in on-board memory (QSPI). To set this, restart the board and press anykey to stop Linux from booting.  (It gives 5 sec to make it stop otherwise, it starts booting Linux.) When you stop it, you get a u-boot prompt i.e. “Zynq>”. Write below command in sequence correctly. If you get any error with any of the command, just restart the board and redo the commands.

Zynq> setenv default_bootcmd 'echo "HELLO WORLD"; mw 0xFFFFFFF0 0x20000000 4; md 0xFFFFFFF0 4; run uenvboot; run cp_kernel2ram && bootm ${netstart}'

Zynq> saveenv

 

Now, restart the board and you should see the following prints as follows, which tells you that everything saved correctly and will start CPU1 after CPU0 gets booted -

U-Boot 2019.01 (Jan 22 2021 - 10:10:59 +0000) Xilinx Zynq ZC702

CPU:   Zynq 7z020
Silicon: v3.1
DRAM:  ECC disabled 512 MiB
MMC:   mmc@e0100000: 0
Loading Environment from SPI Flash... SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Net:   ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
eth0: ethernet@e000b000
Hit any key to stop autoboot:  0
HELLO WORLD
fffffff0: 20000000 20000000 20000000 20000000    ... ... ... ...
Lokesh J.

View solution in original post

0 Kudos