dustyhair

Custom Bootloader Integration

Recommended Posts

Hello, 

 

I was wondering if anyone could point me in the right direction on a problem I am having. 

 

I am trying to understand the ZPUino system and I want to make a customized core for my project so I am trying to just figure out how the whole project source fits together. 

 

I can compile a  with whatever core changes I intend on making bit successfully. There is a bootloader section in the repository which has debug and verbose options. I am attempting to just enable verbose options as an exercise in understanding how all the pieces fit together. I can build the bootloader code successfully 

 

I have searched but I cant seem to find any information on how to integrate a custom bootloader with a custom core. In a previous post i read that the ZPUino doesnt use a bmm file so how do you integrate the bit with the hex of the bootloader.  

 

Could anyone point me in the right direction. 

 

Thanks 

Share this post


Link to post
Share on other sites

Hello, 

 

I was wondering if anyone could point me in the right direction on a problem I am having. 

 

I am trying to understand the ZPUino system and I want to make a customized core for my project so I am trying to just figure out how the whole project source fits together. 

 

I can compile a  with whatever core changes I intend on making bit successfully. There is a bootloader section in the repository which has debug and verbose options. I am attempting to just enable verbose options as an exercise in understanding how all the pieces fit together. I can build the bootloader code successfully 

 

I have searched but I cant seem to find any information on how to integrate a custom bootloader with a custom core. In a previous post i read that the ZPUino doesnt use a bmm file so how do you integrate the bit with the hex of the bootloader.  

 

Could anyone point me in the right direction. 

 

Thanks 

 

Hi,

 

The bootloader is under "bootloader" in the ZPUino HDL sources. If you use linux, a simple "make" is enough to generate the bootloader, however you should run it from the board directory, because you need to provide some extra arguments, like the board ID and memory size.

 

The bootloader is then copied into the board directory. Depending on the version, it might be called "prom-generic-dp-32.vhd" or "bootloader.vhd". You will have to resynthesize the design in order to have the new bootloader.

 

Example of a build command for the bootloader, inside the toplevel directory (zpuino), for version 2.0

make -C bootloader BOARD=PAPILIO_PRO SIZE=16384 DEFINES="-DBOARD_ID=0xA5041700 -DBOARD_MEMORYSIZE=0x800000 -DZPU20 -DZPUINO_HAS_ICACHE"

You might want to take a look at the Makefile inside the board directory for more details.

 

Alvie

Share this post


Link to post
Share on other sites

Ah! Thank you I didn't notice the gen-prom-generic-dualport_32.pl script function. That should give me a boost until the next head scratcher

 

BTW Alvie, are you still working on the linux port for ZPUino? I have read all your blog posts about it but all the information I've seen on it is over a year old.

Share this post


Link to post
Share on other sites

Too much effort for something that is not feasible to use, due to lack of MMU.

 

Perhaps my next design will include an MMU, so we can have more complex operating systems running on it.

Share this post


Link to post
Share on other sites

Ah, I am still having some confusing trouble. For information i am using the LX9 variant.

 

it appears that the bootloader does generate successfully and I move the "prom-generic-dp-32.vhd" and regernate the bit file which does build successfully or i should say without errors. I do get two different warnings

   for parity pin DOPB0.WARNING:PhysDesignRules:1176 - Issue with pin connections and/or configuration   on block:<zpuino/core/cache/cachemem/Mram_RAM3>:<RAMB16BWER_RAMB16BWER>.  The   block is configured to use input parity pin DIBP0. There is dangling output   for parity pin DOPB0.WARNING:PhysDesignRules:2410 - This design is using one or more 9K Block RAMs   (RAMB8BWER).  9K Block RAM initialization data, both user defined and   default, may be incorrect and should not be used.  For more information,   please reference Xilinx Answer Record 39999.

These warnings seem irrelavent to the issue im experiencing, But regardless it still builds.

 

I can upload it to the platform and successfully load a bit file but when i connect and expect to see debug loading information from the bootloader on the serial I don't see anything until the sketch starts.

Share this post


Link to post
Share on other sites

You can safely ignore those warnings.

 

 

when i connect and expect to see debug loading information from the bootloader on the serial I don't see anything until the sketch starts.

 

You might have not replaced correctly the bootloader.

 

If you are using a "modern" terminal application, sending a "break" should cause the system to reset, and you should be able to see at least "ZPUINO" printed.

 

Note: did any error pop up during bootloader creation ? Debugging adds a bit of code and strings, and sometimes it ends up not fitting in the required 4KB space.

Share this post


Link to post
Share on other sites

there doesnt apear to be any errors it says needs to map 16k words but but it doesnt complain about it.

sudo make -C bootloader BOARD=PAPILIO_PRO SIZE=16384 DEFINES="-DBOARD_ID=0xA5041700 -DBOARD_MEMORYSIZE=0x800000 -DZPU20 -DZPUINO_HAS_ICACHE"make: Entering directory `/home/jawagner/Desktop/ZPUino-HDL/zpu/hdl/zpuino/bootloader'/usr/local/zpu-toolchain/bin/zpu-elf-g++ -O2 -fno-gcse -Wall -mno-callpcrel  -fdata-sections -fno-reorder-blocks  -fno-reorder-blocks-and-partition -fno-prefetch-loop-arrays -ffunction-sections -I../common -D__ZPUINO_PAPILIO_PRO__  -DBOARD_ID=0xA5041700 -DBOARD_MEMORYSIZE=0x800000 -DZPU20 -DZPUINO_HAS_ICACHE -fno-exceptions   -c -o boot.o boot.cppboot.cpp: In function `unsigned int inbyte()':boot.cpp:177: warning: comparison between signed and unsigned integer expressions/usr/local/zpu-toolchain/bin/zpu-elf-gcc -O2 -fno-gcse -Wall -mno-callpcrel  -fdata-sections -fno-reorder-blocks  -fno-reorder-blocks-and-partition -fno-prefetch-loop-arrays -ffunction-sections -I../common -D__ZPUINO_PAPILIO_PRO__  -DBOARD_ID=0xA5041700 -DBOARD_MEMORYSIZE=0x800000 -DZPU20 -DZPUINO_HAS_ICACHE   -c -o boot-c.o boot-c.cIn file included from boot-c.c:2:../common/zpuino.h: In function `modeRegisterForPin':../common/zpuino.h:15: warning: suggest parentheses around + or - inside shift../common/zpuino.h: In function `PPSmodeRegisterForPin':../common/zpuino.h:20: warning: suggest parentheses around + or - inside shiftboot-c.c: At top level:boot-c.c:29: warning: '__copy_data' defined but not used/usr/local/zpu-toolchain/bin/zpu-elf-gcc -D__ZPUINO_PAPILIO_PRO__ -DBOARD_ID=0xA5041700 -DBOARD_MEMORYSIZE=0x800000 -DZPU20 -DZPUINO_HAS_ICACHE -DASSEMBLY -I../common   -c -o boot-s.o boot-s.Sboot-s.S:49:5: warning: no newline at end of file/usr/local/zpu-toolchain/bin/zpu-elf-g++ boot.o boot-c.o boot-s.o loader.o -o bootloader.elf -O2 -Wl,-T -Wl,zpuelf.lds -Wl,--relax -Wl,--gc-sections /usr/local/zpu-toolchain/bin/zpu-elf-objdump -D bootloader.elf > bootloader.s/usr/local/zpu-toolchain/bin/zpu-elf-objcopy -O binary bootloader.elf bootloader.bin/usr/local/zpu-toolchain/bin/zpu-elf-objcopy -O ihex bootloader.elf bootloader.hexperl ../gen-prom-generic-dualport_32.pl bootloader.bin 16384 > prom-generic-dp-32.vhd || rm -f prom-generic-dp-32.vhd	Infile is not aligned, fixing....Padded with 20 zeroes.Need to map 16384 wordsNeed 14 bits for addressperl ../gen-prom-generic-dualport-simple_32.pl bootloader.bin 4096 bootloader_dp_32 > bootloader.vhd || rm -f bootloader.vhd	Need to map 4096 wordsNeed 12 bits for address/usr/local/zpu-toolchain/bin/zpu-elf-g++ -O2 -fno-gcse -Wall -mno-callpcrel  -fdata-sections -fno-reorder-blocks  -fno-reorder-blocks-and-partition -fno-prefetch-loop-arrays -ffunction-sections -I../common -D__ZPUINO_PAPILIO_PRO__  -DBOARD_ID=0xA5041700 -DBOARD_MEMORYSIZE=0x800000 -DZPU20 -DZPUINO_HAS_ICACHE -fno-exceptions -S boot.cpp -o bootloader.Sboot.cpp: In function `unsigned int inbyte()':boot.cpp:177: warning: comparison between signed and unsigned integer expressionsmake: Leaving directory `/home/jawagner/Desktop/ZPUino-HDL/zpu/hdl/zpuino/bootloader'

Break command sets LED1 to solid green but no output on the serial like a halted state or something. So if it only maps 4k then it crashes basically?

 

Is there a way to get debug serial to work or is that something thats still beta because of the size issue and i should just disable debugging and go with verbose to see the change

Share this post


Link to post
Share on other sites

Try pressing "ENTER" after the reset, sometimes the comms app do not release the break until you do so.

 

You are using a PPro, correct ? I ask this because the loader is quite different due to the caches and the SDRAM.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now