File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ const DBUS_VADDR_BASE: u32 = 0x3C000000;
77const DR_REG_MMU_TABLE : u32 = 0x600C5000 ;
88const ENTRY_INVALID : u32 = 1 << 14 ;
99const ICACHE_MMU_SIZE : usize = 0x800 ;
10- const TABLE_SIZE : usize = ICACHE_MMU_SIZE / core:: mem:: size_of :: < u32 > ( ) ;
1110
1211pub ( super ) const ENTRY_ACCESS_SPIRAM : u32 = 1 << 15 ;
1312pub ( super ) const PAGE_SIZE : usize = 0x10000 ;
13+ pub ( super ) const TABLE_SIZE : usize = ICACHE_MMU_SIZE / core:: mem:: size_of :: < u32 > ( ) ;
1414
1515extern "C" {
1616 /// Set DCache mmu mapping.
Original file line number Diff line number Diff line change @@ -151,6 +151,9 @@ pub(crate) fn init_psram(config: PsramConfig) {
151151 // bigger than a flash page - i.e. we will see an unmapped memory slot
152152 // start from the end and find the last mapped flash page
153153 let psram_start_index = mmu:: last_mapped_index ( ) . map ( |e| e + 1 ) . unwrap_or ( 0 ) ;
154+ if psram_start_index >= mmu:: TABLE_SIZE {
155+ panic ! ( "PSRAM cannot be mapped as MMU table has no empty trailing entries" ) ;
156+ }
154157 let start = mmu:: index_to_data_address ( psram_start_index) ;
155158 debug ! ( "PSRAM start address = {:x}" , start) ;
156159
You can’t perform that action at this time.
0 commit comments