SD Card fat32 #10

Closed
pca006132 wants to merge 9 commits from pca006132:sd-reader into master

fat32 working

fat32 working

Tested mounting the first partition, reading directories and reading content of BOOT.BIN. Not yet tested for complicated operations.

Currently the functionalities are limited, as this is intended to only be used by the fatfs crate. alloc features are not yet tested as I cannot get the DDR RAM working in my board, and there is still no UART output for the raspberry pi 4 board.

The implementation should be more readable now after refactoring yesterday.

Tested mounting the first partition, reading directories and reading content of `BOOT.BIN`. Not yet tested for complicated operations. Currently the functionalities are limited, as this is intended to only be used by the fatfs crate. `alloc` features are not yet tested as I cannot get the DDR RAM working in my board, and there is still no UART output for the raspberry pi 4 board. The implementation should be more readable now after refactoring yesterday.

When loading the bitstream from SD card, the data starting from 0x19D630 (relative to the file) are wrong. Still investigating the cause, possibly a bug in the SD reader module.

When loading the bitstream from SD card, the data starting from 0x19D630 (relative to the file) are wrong. Still investigating the cause, possibly a bug in the SD reader module.
astro approved these changes 2020-06-13 02:22:46 +08:00
astro left a comment

I see some buffering and fatfs support in the driver. I think it would be cleaner if they were separate modules (structs) that interface each other.

In general, this lgtm. I'm happy to merge working code now and help refactoring afterwards.

I see some buffering and fatfs support in the driver. I think it would be cleaner if they were separate modules (structs) that interface each other. In general, this lgtm. I'm happy to merge working code now and help refactoring afterwards.
@ -0,0 +146,4 @@
self.seek(SeekFrom::Start(entry as u64 + 0x4))?;
self.read_exact(&mut buffer[..1])?;
match buffer[0] {
0x01 | 0x04 | 0x06 | 0x0B => (),

Four self-explanatory const would be nicer than those magic values.

Four self-explanatory `const` would be nicer than those magic values.
sb10q reviewed 2020-06-13 15:30:23 +08:00
@ -45,1 +45,4 @@
ram::init_alloc_linker();
// let mut ddr_ram = ddr::DdrRam::new();
// info!("Init alloc ddr");
// ram::init_alloc_ddr(&mut ddr_ram);

Those lines should never be executed in the runtime.
The runtime is loaded in DDR and assumes that DDR is already initialized (either by SZL or by FSBL). And letting the allocator use the whole DDR, as would be the case when calling init_alloc_ddr, would corrupt the runtime.

Those lines should never be executed in the runtime. The runtime is loaded in DDR and assumes that DDR is already initialized (either by SZL or by FSBL). And letting the allocator use the whole DDR, as would be the case when calling ``init_alloc_ddr``, would corrupt the runtime.

Merged manually.

Merged manually.
sb10q closed this pull request 2020-06-13 15:37:08 +08:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 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#10
There is no content yet.