11-23-2017 01:19 PM - edited 11-23-2017 01:21 PM
(using zynqmp on zcu102)
I have a u-boot that is configured with config_mp.
I have generated and built hello world in xsdk for the r5.
I have generated a binary with the objcopy command and found the main function with the readelf.
If I load the binary to address 0 with u-boot, I can successfully start it with:
cpu 4 release 0x1000fc split
I found the release address with help from readelf.
But if I try the same with a binary linked to be in tcm, I cannot make it work.
I changed the linker script according to the link below.
I can load it to address 0x00FFE00000. That would be the start of the TCM. But if I try with the release row below, I do not get any printouts:
cpu 4 release <address in tcm, cannot remeber right now> split
I got the address with a call to readelf, grepping for main.
03-06-2019 10:57 PM
can you show clear steps of how you were able to start an R5-Application with u-boot?
06-25-2019 12:15 PM
I made the "hello_world" application run onthe R5 using uboot. I am using SDK 2018.2. I am running in lock-step mode.
I used the hsi tool, and my build environemtn is linux (ubuntu 16.04).
linux build environment setup:
hsi% set appdir hello_world
hsi% set hw [hsi::open_hw_design /media/usb0/joveai-dci/fpga/fpga_wrapper_with_bitstream.hdf]
hsi% set cpu psu_cortexr5_0
hsi% set swdesign [hsi::create_sw_design system -proc $cpu -app hello_world]
hsi% hsi::generate_app -hw $hw -sw $swdesign -app hello_world -proc $cpu -dir $appdir
Then I had to manually modfiy the hello_world Makefile and lscript.ld that were generated so that the program would compile and link correctly.
Add "-mfloat-abi=hard" to CFLAGS variable:
CFLAGS := -mfloat-abi=hard
(Optional) Add "-mcpu=cortex-r5" to compile commandline for .c files:
$(CC) $(CC_FLAGS) $(CFLAGS) -c -mcpu=cortex-r5 $< -o $@ $(INCLUDEPATH)
Modify Memory section so that the file is linked to the proper TCM address (example):
/* psu_ocm_ram_0_MEM_0 : ORIGIN = 0xFFFC0000, LENGTH = 0x40000 */
/* psu_qspi_linear_0_MEM_0 : ORIGIN = 0xC0000000, LENGTH = 0x20000000 */
/* psu_r5_0_atcm_MEM_0 : ORIGIN = 0x0, LENGTH = 0x10000 */
/* psu_r5_0_btcm_MEM_0 : ORIGIN = 0x20000, LENGTH = 0x10000 */
/* psu_r5_ddr_0_MEM_0 : ORIGIN = 0x100000, LENGTH = 0x7FE00000 */
/* psu_r5_tcm_ram_0_MEM_0 : ORIGIN = 0x0, LENGTH = 0x40000 */
psu_r5_0_atcm_MEM_0 : ORIGIN = 0x0, LENGTH = 0x10000 /* actyally LENGTH can be smaller */
psu_r5_ddr_0_MEM_0 : ORIGIN = 0x10000, LENGTH = 0x10000 /* you can change these values to use all of the TCM if you like */
Then just make, and executable.elf is produced.
Then use armr5-none-eabi-objcopy to make a binary file:
armr5-none-eabi-objcopy -O binary executable.elf executable.bin
In order to load executable.bin into the TCM, you need to have your FSBL initialize the TCM. To do this change the "FSBL_A53_TCM_ECC_EXCLUDE_VAL" to 0 in your xfsbl_config.h file, and remake your FSBL.
#define FSBL_A53_TCM_ECC_EXCLUDE_VAL (0U)
Now after using this new FSBL, and launching to UBOOT, you can load executable.bin into the TCM, and launch the R5 (example):
setenv autoload no;dhcp;setenv serverip 10.15.10.72;tftpb 0xffe00000 executable.bin
cpu 4 release 0x0 lockstep
Then it just prints "hello world" on the uart.
09-03-2019 12:35 AM - edited 09-03-2019 01:24 AM
thanks for your detailed description. I tried to replicate it but I failed while programming the executable.bin to address 0xffe00000. I get the error:
EDIT: https://forums.xilinx.com/t5/Embedded-Linux/Reading-MPSOC-OCM-from-UBoot/td-p/863789 solved my problem. I had to add CONFIG_DEFINE_TCM_OCM_MMAP to the uboot defines.
"Synchronous Abort" handler, esr 0x96000046 ELR: 8031ab8 LR: 8031a94 x0 : 0000000000000000 x1 : 00000000e59ff018 x2 : 00000000000f41f3 x3 : 00000000ffe00000 x4 : 0000000000000001 x5 : 000000000000000d x6 : 0000000000000000 x7 : 000000007ded854e x8 : 000000007dec28f0 x9 : 0000000000000008 x10: 000000000000000d x11: 00000000ffffffd0 x12: 000000000001869f x13: 0000000000008354 x14: 000000007dec2cdc x15: 0000000000000002 x16: 0000000000008110 x17: 0000000000000000 x18: 000000007dec2df8 x19: 000000007dec48e0 x20: 0000000000000020 x21: 0000000000000000 x22: 000000007dec2988 x23: 0000000000000000 x24: 0000000000000030 x25: 00000000000f41f3 x26: 000000007ff6f000 x27: 0000000000000000 x28: 000000000000fff0 x29: 000000007dec28c0
I cant even read or write to/from address 0xffe00000 via the md & mm uboot commands without such a Synchronous Abort error beeing thrown. Is there anything obvious I missed or why cant I access the TCM from the APU?
09-03-2019 08:24 PM
That is interesting. For me, CONFIG_DEFINE_TCM_OCM_MMAP is set by default from u-boot.
Symbol: DEFINE_TCM_OCM_MMAP [=y]
Type : bool
Prompt: Define TCM and OCM memory in MMU Table
(1) -> ARM architecture
Defined at arch/arm/mach-zynqmp/Kconfig:80
Depends on: ARM [=y] && ARCH_ZYNQMP [=y]
Looks like I just got lucky because I used a later uboot which has this set by default.