Skip to content

Commit d4407ee

Browse files
authored
fix(rt): fix the image header of bl808 (#22)
* Fix the image header of bl808 Signed-off-by: LiuWeijun <m202472188@hust.edu.cn> * Correct the test of magic_crc32_hal_pll_config --------- Signed-off-by: LiuWeijun <m202472188@hust.edu.cn>
1 parent b0ac13e commit d4407ee

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

bouffalo-rt/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ pub static FLASH_CONFIG: HalFlashConfig = HalFlashConfig::new(SpiFlashCfgType {
400400
time_e_sector: 300,
401401
time_e_32k: 1200,
402402
time_e_64k: 1200,
403-
time_ce: 30000,
403+
time_ce: 33000,
404404
time_page_pgm: 50,
405405
pd_delay: 20,
406406
qe_data: 0,
@@ -511,14 +511,14 @@ mod tests {
511511
time_e_sector: 300,
512512
time_e_32k: 1200,
513513
time_e_64k: 1200,
514-
time_ce: 30000,
514+
time_ce: 33000,
515515
time_page_pgm: 50,
516516
pd_delay: 20,
517517
qe_data: 0,
518518
};
519519
let test_config = HalFlashConfig::new(test_spi_flash_config);
520520
assert_eq!(test_config.magic, 0x47464346);
521-
assert_eq!(test_config.crc32, 0x18c5feb5);
521+
assert_eq!(test_config.crc32, 0x482adef8);
522522
}
523523

524524
#[test]

bouffalo-rt/src/soc/bl808.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ pub static CLOCK_CONFIG: HalPllConfig = HalPllConfig::new(HalSysClkConfig {
563563

564564
dsp_bclk_div: 0x01,
565565
dsp_pbclk: 0x02,
566-
dsp_pbclk_div: 0x02,
566+
dsp_pbclk_div: 0x00,
567567
emi_clk: 0x02,
568568

569569
emi_clk_div: 0x01,
@@ -627,7 +627,17 @@ pub static CPU_CONFIG: [HalCpuCfg; 3] = [
627627
msp_val: 0,
628628
},
629629
#[cfg(not(feature = "bl808-lp"))]
630-
HalCpuCfg::disabled(),
630+
HalCpuCfg {
631+
config_enable: 0,
632+
halt_cpu: 0,
633+
cache_flags: 0,
634+
_rsvd: 0,
635+
cache_range_h: 1476722688,
636+
cache_range_l: 1476657152,
637+
image_address_offset: 0x42000,
638+
boot_entry: 0x58040000,
639+
msp_val: 0,
640+
},
631641
];
632642

633643
/// Code patches on flash reading.
@@ -799,7 +809,7 @@ impl HalCpuCfg {
799809
cache_range_h: 0,
800810
cache_range_l: 0,
801811
image_address_offset: 0,
802-
boot_entry: 0x0,
812+
boot_entry: 0x58000000,
803813
msp_val: 0,
804814
}
805815
}
@@ -1013,7 +1023,7 @@ mod tests {
10131023
#[test]
10141024
fn magic_crc32_hal_pll_config() {
10151025
let test_sys_clk_config = HalSysClkConfig {
1016-
xtal_type: 4,
1026+
xtal_type: 7,
10171027
mcu_clk: 4,
10181028
mcu_clk_div: 0,
10191029
mcu_bclk_div: 0,
@@ -1036,6 +1046,6 @@ mod tests {
10361046
};
10371047
let test_config = HalPllConfig::new(test_sys_clk_config);
10381048
assert_eq!(test_config.magic, 0x47464350);
1039-
assert_eq!(test_config.crc32, 0x29e2c4c0);
1049+
assert_eq!(test_config.crc32, 0x864b890a);
10401050
}
10411051
}

0 commit comments

Comments
 (0)