parsed and loaded bitstream from bootimage #12

Merged
sb10q merged 1 commits from pca006132/artiq-zynq:devc-clean into master 2020-06-16 17:47:27 +08:00

It can now parse the header and load the bitstream from the bootimage, i.e. boot.bin stored in the SD card.

It can now parse the header and load the bitstream from the bootimage, i.e. `boot.bin` stored in the SD card.
sb10q reviewed 2020-06-15 17:30:09 +08:00
@ -40,0 +129,4 @@
let buffer = &mut raw_buffer[offset..unencrypted_length as usize * 4 + offset];
file.read_exact(buffer).unwrap();
cache::dcci_slice(buffer);

Shouldn't this be moved into the devc driver?

Shouldn't this be moved into the devc driver?

This requires refactoring, as the current implementation just takes a u32 as address... but should be simple to do

This requires refactoring, as the current implementation just takes a `u32` as address... but should be simple to do

OK please do it.

OK please do it.
sb10q reviewed 2020-06-15 17:31:35 +08:00
@ -40,0 +89,4 @@
// read boot header signature
file.seek(SeekFrom::Start(0x24)).unwrap();
if read_u32(file) != BOOT_HEADER_SIGN {
panic!("Invalid header!");

I would not use panic! here, instead return a Result.

Suggest moving all this boot.bin and bitstream loading code into its own file, e.g. runtime/src/load_pl.rs

I would not use ``panic!`` here, instead return a ``Result``. Suggest moving all this boot.bin and bitstream loading code into its own file, e.g. ``runtime/src/load_pl.rs``

ok, I would try to turn the panic things and unwrap things into appropriate error handling and refactor them into load_pl.rs.

ok, I would try to turn the `panic` things and `unwrap` things into appropriate error handling and refactor them into `load_pl.rs`.
sb10q reviewed 2020-06-16 16:02:05 +08:00
@ -60,3 +56,2 @@
} else {
info!("loading gateware");
unimplemented!("gateware loading");
// Load from SD card

Move this (i.e. the "Load for SD card" block, but not the "devc.is_done" test) to load_pl as well.

Move this (i.e. the "Load for SD card" block, but not the "devc.is_done" test) to load_pl as well.
sb10q reviewed 2020-06-16 16:09:27 +08:00
@ -46,20 +47,43 @@ pub fn main_core0() {
ram::init_alloc_linker();
match config::read_str("foo") {

Leave this.

Leave this.
sb10q reviewed 2020-06-16 16:09:58 +08:00
@ -232,3 +232,3 @@
name = "libsupport_zynq"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#a17a5d2925e7e521f31320ccefd7bf3cb61c45a7"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#191da7c959baeb30e31196f2c35b0790ea25cbf6"

Changing Cargo.lock requires updating cargoSha256 in default.nix.

Changing Cargo.lock requires updating cargoSha256 in default.nix.
sb10q reviewed 2020-06-16 16:51:20 +08:00
@ -57,3 +58,1 @@
// Do not load again: assume that the gateware already present is
// what we want (e.g. gateware configured via JTAG before PS
// startup, or by FSBL).
// Do not load again: assume that the gateware already present is

This should be indented one more block.

This should be indented one more block.
sb10q reviewed 2020-06-16 16:51:37 +08:00
@ -23,3 +26,1 @@
mod kernel;
mod moninj;
mod sd_reader;

Why change the order of the imports?

Why change the order of the imports?
sb10q reviewed 2020-06-16 16:51:44 +08:00
@ -9,3 +9,3 @@
use log::info;
use libboard_zynq::{timer::GlobalTimer, logger, devc};
use fatfs::File;

Is this used?

Is this used?
sb10q reviewed 2020-06-16 16:54:17 +08:00
@ -61,2 +62,2 @@
info!("loading gateware");
unimplemented!("gateware loading");
// Load from SD card
match load_pl::load_bitstream_from_sd(&mut devc) {

I think the load_pl module should create the DevC object itself.
Release it above using e.g.

let is_done = {
  let devc = devc::DevC::new();
  devc.is_done()
};

or simply if devc::DevC::new().is_done() if that works?

I think the ``load_pl`` module should create the DevC object itself. Release it above using e.g. ```rust let is_done = { let devc = devc::DevC::new(); devc.is_done() }; ``` or simply ``if devc::DevC::new().is_done()`` if that works?

I think it should work. I pass the DevC object as I thought we should treat that as a singleton, I would change that.

I think it should work. I pass the DevC object as I thought we should treat that as a singleton, I would change that.
sb10q closed this pull request 2020-06-16 17:47:27 +08:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/artiq-zynq#12
There is no content yet.