bare metal app

Applications, development tools, FPGA, C, WEB
Mike1010
Posts: 23
Joined: Mon Jun 15, 2015 8:02 pm

Re: bare metal app

Post by Mike1010 » Mon Jun 15, 2015 11:40 pm

i hope i manage all those modifications in the lscript.ld linkerscript. can you comment on that too nils? :)
Last edited by Mike1010 on Mon Jun 15, 2015 11:43 pm, edited 1 time in total.

pavel
Posts: 790
Joined: Sat May 23, 2015 5:22 pm

Re: bare metal app

Post by pavel » Mon Jun 15, 2015 11:42 pm

Thanks Nils.

I've just had a quick look at xapp1078_2014.4.zip.

It contains the following file
design\src\bootgen\bootimage.bif

Here is what it contains:

Code: Select all

the_ROM_image:
{

  [bootloader] zynq_fsbl.elf
               ../project_1/project_1.sdk/design_1_wrapper_hw_platform_0/design_1_wrapper.bit
	       u-boot.elf
	       ../project_1/project_1.sdk/app_cpu1/Debug/app_cpu1.elf

}
So, indeed [load..] can be omitted and the commands to generate boot.bin should look like the following:

Code: Select all

echo "img:{[bootloader] tmp/red_pitaya_0_92.fsbl/executable.elf tmp/red_pitaya_0_92.bit tmp/u-boot.elf app_cpu1.elf}" > tmp/boot.bif
bootgen -image tmp/boot.bif -w -o i boot.bin

Mike1010
Posts: 23
Joined: Mon Jun 15, 2015 8:02 pm

Re: bare metal app

Post by Mike1010 » Tue Jun 16, 2015 8:32 pm

I started the SDK: File-New-Board Support Package

The SDK requires a hardware platform specification to support application development. See: http://s10.postimg.org/tuo874w3d/image.jpg
Where can I get this file for rp?

pavel
Posts: 790
Joined: Sat May 23, 2015 5:22 pm

Re: bare metal app

Post by pavel » Wed Jun 17, 2015 7:44 am

Commands to create .hdf file using my Makefile:

Code: Select all

source /opt/Xilinx/Vivado/2015.1/settings64.sh
source /opt/Xilinx/SDK/2015.1/settings64.sh

git clone https://github.com/pavel-demin/red-pitaya-notes
cd red-pitaya-notes

make NAME=red_pitaya_0_92 all

mkdir tmp/red_pitaya_0_92.sdk
cp tmp/red_pitaya_0_92.hwdef tmp/red_pitaya_0_92.sdk/red_pitaya_0_92.hdf
If you installed your development machine following my instructions, then you'll need to install an additional package required by the Xilinx SDK GUI:

Code: Select all

sudo apt-get install libgtk2.0-0
Command to start Xilinx SDK GUI:

Code: Select all

xsdk -workspace tmp/red_pitaya_0_92.sdk -hwspec tmp/red_pitaya_0_92.sdk/red_pitaya_0_92.hdf

Mike1010
Posts: 23
Joined: Mon Jun 15, 2015 8:02 pm

Re: bare metal app

Post by Mike1010 » Wed Jun 17, 2015 8:55 am

The doc tells me to create the following two projects. Now i can add the following two projects?
I need to add the lscript.ld etc...
Create the BSP for CPU1
Select File->New->Board_Support_Package
Enter the project name 'app_cpu1_bsp'
Change CPU to ps7_cortexa9_1.
Notice that Board Support Package OS defaults to standalone and the description starts with 'Modified Standalone based on ....' This description
lets you know that the modified BSP is used from the local repository that was configured.
Select Finish
In the 'Board Support Package Settings' Select Overview->standalone and change stdin and stdout to None
Select Overview->drivers->ps7_cortexa9_1 and change the extra_compiler_flags value to contain '-g -DUSE_AMP=1 -DSTDOUT_REDIR=1'
Select OK
Create the Application that will run on CPU1
Select File->New->Application_Project
Enter the project name 'app_cpu1'
Change Processor to ps7_cortexa9_1
Change 'Board Support Package' to 'Use existing' 'app_cpu1_bsp' and select Next
Select the template 'Empty Application' then select Finish.
Import the C and linkerscript file for app_cpu1 by navigating to SDK Project Explorer and right clicking on app_cpu1/src and select 'Import'
Select General->File_System then select Next
In the 'From directory', browse to and select <xapp1078_2014.4>/design/src/apps/app_cpu1
In the right window, select all .c, .h and lscript.ld then select Finish. Answer Yes to overwrite lscript.ld
Note: instead of using Import, the files could be dragged from MS Windows File Explorer to the SDK Project Explorer app_cpu1/src
directory. Select 'Copy files' when prompted and 'Yes' to overwrite lscript.ld

pavel
Posts: 790
Joined: Sat May 23, 2015 5:22 pm

Re: bare metal app

Post by pavel » Wed Jun 17, 2015 9:10 am

I suppose that you are looking at "xapp1078_2014.4.zip/docs/Vivado instructions.txt".

The commands from my previous comment are equivalent to the first part of the "Vivado instructions.txt" including the following line
When the script finishes running it will open SDK. In the SDK workspace a hardware platform project is
created automatically.
Then I suppose that you should try to follow the second part of the "Vivado instructions.txt"
Last edited by pavel on Wed Jun 17, 2015 10:50 am, edited 1 time in total.

Mike1010
Posts: 23
Joined: Mon Jun 15, 2015 8:02 pm

Re: bare metal app

Post by Mike1010 » Wed Jun 17, 2015 9:20 am

Yes.
I created the app_cpu1_bsp project and the app_cpu1 application project. I imported the .c, .h snd ldscript from design/src/apps/app_cpu1.

In app_cpu1.h the compiler cant find the following define:

Code: Select all

#define IRQ_PCORE_GEN_BASE XPAR_IRQ_GEN_0_BASEADDR
...any idea? The app serves interrupts from the PL...can you add those support in your hwdef? Edit: i guess i can remove all the interrupt code for now?

What will i change in lscript.ld? There are the settings:

Code: Select all

_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000;
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x2000;

_ABORT_STACK_SIZE = DEFINED(_ABORT_STACK_SIZE) ? _ABORT_STACK_SIZE : 1024;
_SUPERVISOR_STACK_SIZE = DEFINED(_SUPERVISOR_STACK_SIZE) ? _SUPERVISOR_STACK_SIZE : 2048;
_IRQ_STACK_SIZE = DEFINED(_IRQ_STACK_SIZE) ? _IRQ_STACK_SIZE : 1024;
_FIQ_STACK_SIZE = DEFINED(_FIQ_STACK_SIZE) ? _FIQ_STACK_SIZE : 1024;
_UNDEF_STACK_SIZE = DEFINED(_UNDEF_STACK_SIZE) ? _UNDEF_STACK_SIZE : 1024;

/* Define Memories in the system */

MEMORY
{
   ps7_ddr_0_S_AXI_BASEADDR : ORIGIN = 0x30000000, LENGTH = 0x10000000
   ps7_ram_0_S_AXI_BASEADDR : ORIGIN = 0x00000000, LENGTH = 0x00030000
   ps7_ram_1_S_AXI_BASEADDR : ORIGIN = 0xFFFF0000, LENGTH = 0x0000FE00
}
I need to align those with the memory setting in the device tree? I use the default setting you have...

I also need to add maxcpus=1 to the bootargs in the file scripts/devicetree.tcl so that linux only uses core0!?

Mike1010
Posts: 23
Joined: Mon Jun 15, 2015 8:02 pm

Re: bare metal app

Post by Mike1010 » Wed Jun 17, 2015 8:29 pm

Im not sure about those settings! Any help?

pavel
Posts: 790
Joined: Sat May 23, 2015 5:22 pm

Re: bare metal app

Post by pavel » Wed Jun 17, 2015 8:49 pm

Mike1010 wrote:Im not sure about those settings! Any help?
I don't think that I could help you more than what I have already. It's your turn to find a working solution and share it with us :D

I'd be interested to know what kind of project are you working on and what are advantages of running a bare metal application on the second CPU core? Is it for some kind of hard real-time system?

Maybe this information would allow me to help you more :D

Mike1010
Posts: 23
Joined: Mon Jun 15, 2015 8:02 pm

Re: bare metal app

Post by Mike1010 » Wed Jun 17, 2015 9:18 pm

Yes, i want to run a real time app on core1.

May i ask you why your device tree only uses 0 - 0x1E000000 (480MB)?

I compiled the kernel with the current settings and ubutu did not boot up again... Not a good sign!

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 19 guests