|
54 | 54 | #define RAM_CODE __attribute__((section(".ram_code"))) |
55 | 55 |
|
56 | 56 | // Memory Bank Symbols from Linker |
57 | | -extern "C" const uintptr_t __itcm_base; |
58 | | -extern "C" const size_t __itcm_size; |
59 | | -extern "C" const uintptr_t __dtcm_base; |
60 | | -extern "C" const size_t __dtcm_size; |
61 | | -extern "C" const uintptr_t __flash_base; |
62 | | -extern "C" const size_t __flash_size; |
63 | | -extern "C" const uintptr_t __ram_d1_base; |
64 | | -extern "C" const size_t __ram_d1_size; |
65 | | -extern "C" const uintptr_t __ram_d2_base; |
66 | | -extern "C" const size_t __ram_d2_size; |
67 | | -extern "C" const uintptr_t __ram_d3_base; |
68 | | -extern "C" const size_t __ram_d3_size; |
69 | | -extern "C" const uintptr_t __peripheral_base; |
70 | | -extern "C" const size_t __peripheral_size; |
| 57 | +extern "C" const char __itcm_base; |
| 58 | +extern "C" const char __itcm_size; |
| 59 | +extern "C" const char __dtcm_base; |
| 60 | +extern "C" const char __dtcm_size; |
| 61 | +extern "C" const char __flash_base; |
| 62 | +extern "C" const char __flash_size; |
| 63 | +extern "C" const char __ram_d1_base; |
| 64 | +extern "C" const char __ram_d1_size; |
| 65 | +extern "C" const char __ram_d2_base; |
| 66 | +extern "C" const char __ram_d2_size; |
| 67 | +extern "C" const char __ram_d3_base; |
| 68 | +extern "C" const char __ram_d3_size; |
| 69 | +extern "C" const char __peripheral_base; |
| 70 | +extern "C" const char __peripheral_size; |
71 | 71 |
|
72 | 72 | // MPU Non-Cached Section Symbols from Linker |
73 | | -extern "C" const uintptr_t __mpu_d1_nc_start; |
74 | | -extern "C" const uintptr_t __mpu_d1_nc_end; |
75 | | -extern "C" const uintptr_t __mpu_d2_nc_start; |
76 | | -extern "C" const uintptr_t __mpu_d2_nc_end; |
77 | | -extern "C" const uintptr_t __mpu_d3_nc_start; |
78 | | -extern "C" const uintptr_t __mpu_d3_nc_end; |
| 73 | +extern "C" const char __mpu_d1_nc_start; |
| 74 | +extern "C" const char __mpu_d1_nc_end; |
| 75 | +extern "C" const char __mpu_d2_nc_start; |
| 76 | +extern "C" const char __mpu_d2_nc_end; |
| 77 | +extern "C" const char __mpu_d3_nc_start; |
| 78 | +extern "C" const char __mpu_d3_nc_end; |
79 | 79 |
|
80 | 80 |
|
81 | 81 | template <typename T> |
@@ -366,42 +366,42 @@ struct MPUDomain { |
366 | 366 |
|
367 | 367 | // Peripherals (Device, Buffered) |
368 | 368 | // Guarded against speculative execution and cache |
369 | | - configure_region(__peripheral_base, __peripheral_size, MPU_REGION_NUMBER8, |
| 369 | + configure_region(reinterpret_cast<uintptr_t>(&__peripheral_base), reinterpret_cast<size_t>(&__peripheral_size), MPU_REGION_NUMBER8, |
370 | 370 | MPU_TEX_LEVEL0, MPU_REGION_FULL_ACCESS, MPU_INSTRUCTION_ACCESS_DISABLE, |
371 | 371 | MPU_ACCESS_SHAREABLE, MPU_ACCESS_NOT_CACHEABLE, MPU_ACCESS_BUFFERABLE); |
372 | 372 |
|
373 | 373 | // Flash (Normal, Cacheable) |
374 | 374 | // TEX=1, C=1, B=0: Normal, Write-Through (Read optimized) |
375 | 375 | // Not Shareable to allow full caching |
376 | | - configure_region(__flash_base, __flash_size, MPU_REGION_NUMBER1, |
| 376 | + configure_region(reinterpret_cast<uintptr_t>(&__flash_base), reinterpret_cast<size_t>(&__flash_size), MPU_REGION_NUMBER1, |
377 | 377 | MPU_TEX_LEVEL1, MPU_REGION_FULL_ACCESS, MPU_INSTRUCTION_ACCESS_ENABLE, |
378 | 378 | MPU_ACCESS_NOT_SHAREABLE, MPU_ACCESS_CACHEABLE, MPU_ACCESS_NOT_BUFFERABLE); |
379 | 379 |
|
380 | 380 | // DTCM (Normal, Cacheable) |
381 | 381 | // Uses Normal memory attributes. TCM access is uncached by hardware, but "Normal" allows unaligned access. |
382 | | - configure_region(__dtcm_base, __dtcm_size, MPU_REGION_NUMBER10, |
| 382 | + configure_region(reinterpret_cast<uintptr_t>(&__dtcm_base), reinterpret_cast<size_t>(&__dtcm_size), MPU_REGION_NUMBER10, |
383 | 383 | MPU_TEX_LEVEL1, MPU_REGION_FULL_ACCESS, MPU_INSTRUCTION_ACCESS_DISABLE, |
384 | 384 | MPU_ACCESS_NOT_SHAREABLE, MPU_ACCESS_CACHEABLE, MPU_ACCESS_BUFFERABLE); |
385 | 385 |
|
386 | 386 | // ITCM (Normal, Cacheable) |
387 | | - configure_region(__itcm_base, __itcm_size, MPU_REGION_NUMBER11, |
| 387 | + configure_region(reinterpret_cast<uintptr_t>(&__itcm_base), reinterpret_cast<size_t>(&__itcm_size), MPU_REGION_NUMBER11, |
388 | 388 | MPU_TEX_LEVEL1, MPU_REGION_FULL_ACCESS, MPU_INSTRUCTION_ACCESS_ENABLE, |
389 | 389 | MPU_ACCESS_NOT_SHAREABLE, MPU_ACCESS_CACHEABLE, MPU_ACCESS_BUFFERABLE); |
390 | 390 |
|
391 | 391 | // D1 RAM Cached (Normal, WBWA) |
392 | 392 | // TEX=1, C=1, B=1: Normal, Write-Back, Write-Allocate |
393 | 393 | // Not Shareable ensures strict L1 utilization. |
394 | | - configure_region(__ram_d1_base, __ram_d1_size, MPU_REGION_NUMBER2, |
| 394 | + configure_region(reinterpret_cast<uintptr_t>(&__ram_d1_base), reinterpret_cast<size_t>(&__ram_d1_size), MPU_REGION_NUMBER2, |
395 | 395 | MPU_TEX_LEVEL1, MPU_REGION_FULL_ACCESS, MPU_INSTRUCTION_ACCESS_DISABLE, |
396 | 396 | MPU_ACCESS_NOT_SHAREABLE, MPU_ACCESS_CACHEABLE, MPU_ACCESS_BUFFERABLE); |
397 | 397 |
|
398 | 398 | // D2 RAM Cached (Normal, WBWA) |
399 | | - configure_region(__ram_d2_base, __ram_d2_size, MPU_REGION_NUMBER4, |
| 399 | + configure_region(reinterpret_cast<uintptr_t>(&__ram_d2_base), reinterpret_cast<size_t>(&__ram_d2_size), MPU_REGION_NUMBER4, |
400 | 400 | MPU_TEX_LEVEL1, MPU_REGION_FULL_ACCESS, MPU_INSTRUCTION_ACCESS_DISABLE, |
401 | 401 | MPU_ACCESS_NOT_SHAREABLE, MPU_ACCESS_CACHEABLE, MPU_ACCESS_BUFFERABLE); |
402 | 402 |
|
403 | 403 | // D3 RAM Cached (Normal, WBWA) |
404 | | - configure_region(__ram_d3_base, __ram_d3_size, MPU_REGION_NUMBER6, |
| 404 | + configure_region(reinterpret_cast<uintptr_t>(&__ram_d3_base), reinterpret_cast<size_t>(&__ram_d3_size), MPU_REGION_NUMBER6, |
405 | 405 | MPU_TEX_LEVEL1, MPU_REGION_FULL_ACCESS, MPU_INSTRUCTION_ACCESS_DISABLE, |
406 | 406 | MPU_ACCESS_NOT_SHAREABLE, MPU_ACCESS_CACHEABLE, MPU_ACCESS_BUFFERABLE); |
407 | 407 | } |
|
0 commit comments