mirror of https://github.com/YosysHQ/picorv32.git
Improved firmware for vivado "system" example
This commit is contained in:
parent
0249d538fa
commit
d8c3157bf8
2
Makefile
2
Makefile
|
@ -43,7 +43,7 @@ synth.v: picorv32.v scripts/yosys/synth_sim.ys
|
|||
yosys -qv3 -l synth.log scripts/yosys/synth_sim.ys
|
||||
|
||||
firmware/firmware.hex: firmware/firmware.bin firmware/makehex.py
|
||||
python3 firmware/makehex.py $< > $@
|
||||
python3 firmware/makehex.py $< 16384 > $@
|
||||
|
||||
firmware/firmware.bin: firmware/firmware.elf
|
||||
$(TOOLCHAIN_PREFIX)objcopy -O binary $< $@
|
||||
|
|
|
@ -18,7 +18,7 @@ timing.exe: testbench.v ../picorv32.v
|
|||
chmod -x timing.exe
|
||||
|
||||
dhry.hex: dhry.bin ../firmware/makehex.py
|
||||
python3 ../firmware/makehex.py $< > $@
|
||||
python3 ../firmware/makehex.py $< 16384 > $@
|
||||
|
||||
dhry.bin: dhry.elf
|
||||
riscv64-unknown-elf-objcopy -O binary $< $@
|
||||
|
|
|
@ -9,13 +9,16 @@
|
|||
|
||||
from sys import argv
|
||||
|
||||
with open(argv[1], "rb") as f:
|
||||
binfile = argv[1]
|
||||
nwords = int(argv[2])
|
||||
|
||||
with open(binfile, "rb") as f:
|
||||
bindata = f.read()
|
||||
|
||||
assert len(bindata) < 60*1024
|
||||
assert len(bindata) < 4*nwords
|
||||
assert len(bindata) % 4 == 0
|
||||
|
||||
for i in range(64*1024//4):
|
||||
for i in range(nwords):
|
||||
if i < len(bindata) // 4:
|
||||
w = bindata[4*i : 4*i+4]
|
||||
print("%02x%02x%02x%02x" % (w[3], w[2], w[1], w[0]))
|
||||
|
|
|
@ -38,9 +38,9 @@ sim_system:
|
|||
|
||||
firmware.hex: firmware.S firmware.c firmware.lds
|
||||
$(TOOLCHAIN_PREFIX)gcc -Os -m32 -ffreestanding -nostdlib -o firmware.elf firmware.S firmware.c \
|
||||
-Wl,-Bstatic,-T,firmware.lds,-Map,firmware.map,--strip-debug -lgcc
|
||||
--std=gnu99 -Wl,-Bstatic,-T,firmware.lds,-Map,firmware.map,--strip-debug -lgcc
|
||||
$(TOOLCHAIN_PREFIX)objcopy -O binary firmware.elf firmware.bin
|
||||
python3 ../../firmware/makehex.py firmware.bin > firmware.hex
|
||||
python3 ../../firmware/makehex.py firmware.bin 4096 > firmware.hex
|
||||
|
||||
tab_%/results.txt:
|
||||
bash tabtest.sh $@
|
||||
|
@ -58,5 +58,5 @@ table.txt:
|
|||
clean:
|
||||
rm -rf .Xil/ firmware.bin firmware.elf firmware.hex firmware.map synth_*.log
|
||||
rm -rf synth_*.mmi synth_*.bit synth_system.v table.txt tab_*/ webtalk.jou
|
||||
rm -rf webtalk.log webtalk_*.jou webtalk_*.log xelab.* xsim.* xvlog.*
|
||||
rm -rf webtalk.log webtalk_*.jou webtalk_*.log xelab.* xsim[._]* xvlog.*
|
||||
|
||||
|
|
|
@ -8,7 +8,36 @@ void puts(const char *s)
|
|||
while (*s) putc(*s++);
|
||||
}
|
||||
|
||||
void *memcpy(void *dest, const void *src, int n)
|
||||
{
|
||||
while (n) {
|
||||
n--;
|
||||
((char*)dest)[n] = ((char*)src)[n];
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
puts("Hello World!\n");
|
||||
char message[] = "$Uryyb+Jbeyq!+Vs+lbh+pna+ernq+guvf+zrffntr+gura$gur+CvpbEI32+PCH"
|
||||
"+frrzf+gb+or+jbexvat+whfg+svar.$$++++++++++++++++GRFG+CNFFRQ!$$";
|
||||
for (int i = 0; message[i]; i++)
|
||||
switch (message[i])
|
||||
{
|
||||
case 'a' ... 'm':
|
||||
case 'A' ... 'M':
|
||||
message[i] += 13;
|
||||
break;
|
||||
case 'n' ... 'z':
|
||||
case 'N' ... 'Z':
|
||||
message[i] -= 13;
|
||||
break;
|
||||
case '$':
|
||||
message[i] = '\n';
|
||||
break;
|
||||
case '+':
|
||||
message[i] = ' ';
|
||||
break;
|
||||
}
|
||||
puts(message);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue