Compare commits

..

4 Commits

6 changed files with 90 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
hw/
# ---> C++ # ---> C++
# Prerequisites # Prerequisites
*.d *.d

BIN
blackboard.xsa Normal file

Binary file not shown.

BIN
main.elf Executable file

Binary file not shown.

9
open_hw.tcl Normal file
View File

@ -0,0 +1,9 @@
set SRC_XSA_FILE [lindex $argv 0]
set HW_WORK_DIR hw
set WORK_XSA_FILE $HW_WORK_DIR/hw.xsa
exec mkdir "$HW_WORK_DIR"
exec cp "$SRC_XSA_FILE" "$WORK_XSA_FILE"
openhw "$WORK_XSA_FILE"

61
run.tcl Normal file
View File

@ -0,0 +1,61 @@
set PART xc7z007s
set APP_ELF main.elf
set HW_WORK_DIR hw
set HW_WORK_XSA_FILE $HW_WORK_DIR/hw.xsa
set HW_ADDR_BEGIN 0x40000000
set HW_ADDR_END 0xbfffffff
# Connect to HW server and get target IDS
connect
puts "--- Targets ---"
puts "[targets]"
puts "--- ------- ---"
set TARGET_APU [lindex [targets -filter {name =~ "APU*"}] 0]
set TARGET_PS0 [lindex [targets -filter {name =~ "*A9*#0"}] 0]
set TARGET_PL [lindex [targets -filter {name =~ "$PART"}] 0]
set TARGET_APU [string trim $TARGET_APU *]
set TARGET_PS0 [string trim $TARGET_PS0 *]
set TARGET_PL [string trim $TARGET_PL *]
puts "Target APU ID: $TARGET_APU"
puts "Target PS0 ID: $TARGET_PS0"
puts "Target PL ID: $TARGET_PL"
targets $TARGET_APU
# Reset and wait
rst -system
after 3000
# Program PL
targets $TARGET_PL
fpga -file "$HW_WORK_DIR/bist.bit"
loadhw -hw "$HW_WORK_XSA_FILE" -mem-ranges [list {0x40000000 0xbfffffff}]
# Disable access protection for dow command
configparams force-mem-accesses 1
# Init and program PS
targets $TARGET_APU
source "$HW_WORK_DIR/ps7_init.tcl"
ps7_init
ps7_post_config
targets $TARGET_PS0
dow "$APP_ELF"
# Re-enable access protection
configparams force-mem-accesses 0
# Start
targets $TARGET_PS0
con

18
src/main.s Normal file
View File

@ -0,0 +1,18 @@
.text
.global main
@define constants, these can be used as symbols in your code
.equ LED_CTL, 0x41210000
.set SW_DATA, 0x41220000
@the set and equ directives are equivalent and can be used interchangeably
main:
ldr r1,=SW_DATA @load switch address from constant
ldr r2,=LED_CTL @load LED address from constant
loop:
ldr r0,[r1] @load switch value *r1 ->r0
str r0,[r2] @store value to led register *r2 <-r0
b loop @go back to "loop"
.end