Changeset f7f420e in rtems
- Timestamp:
- 09/06/17 05:42:06 (6 years ago)
- Branches:
- 5, master
- Children:
- 4e0ba7e
- Parents:
- bdbf1ffa
- git-author:
- Christian Mauderer <Christian.Mauderer@…> (09/06/17 05:42:06)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (09/07/17 07:26:05)
- Location:
- c/src/lib/libbsp/arm/atsam
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/arm/atsam/libraries/libboard/source/board_lowlevel.c
rbdbf1ffa rf7f420e 93 93 END_Addr:- 0x003FFFFFUL 94 94 ****************************************************/ 95 95 96 dwRegionBaseAddr = 96 97 ITCM_START_ADDRESS | … … 98 99 MPU_DEFAULT_ITCM_REGION; // 1 99 100 101 #ifdef __rtems__ 102 if (ITCM_END_ADDRESS + 1 != ITCM_START_ADDRESS) { 103 #endif /* __rtems__ */ 100 104 dwRegionAttr = 101 105 MPU_AP_PRIVILEGED_READ_WRITE | 102 106 MPU_CalMPURegionSize(ITCM_END_ADDRESS - ITCM_START_ADDRESS) | 103 107 MPU_REGION_ENABLE; 104 105 MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); 108 #ifdef __rtems__ 109 } else { 110 dwRegionAttr = MPU_REGION_DISABLE; 111 } 112 #endif /* __rtems__ */ 113 114 MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); 115 106 116 107 117 /**************************************************** … … 137 147 MPU_DEFAULT_DTCM_REGION; //3 138 148 149 #ifdef __rtems__ 150 if (DTCM_END_ADDRESS + 1 != DTCM_START_ADDRESS) { 151 #endif /* __rtems__ */ 139 152 dwRegionAttr = 140 153 MPU_AP_PRIVILEGED_READ_WRITE | … … 142 155 MPU_CalMPURegionSize(DTCM_END_ADDRESS - DTCM_START_ADDRESS) | 143 156 MPU_REGION_ENABLE; 144 145 MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); 157 #ifdef __rtems__ 158 } else { 159 dwRegionAttr = MPU_REGION_DISABLE; 160 } 161 #endif /* __rtems__ */ 162 163 MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); 164 146 165 147 166 /**************************************************** … … 184 203 185 204 MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); 205 #else /* __rtems__ */ 206 /* NOTE: The first SRAM region is increased so it covers the whole SRAM. If 207 * the SRAM is something odd (like 384k on the SAME70Q21), the next higher 208 * power of two will be used (in the example: 512k). That removes the need of 209 * the second SRAM region. There is currently no memory after the SRAM so that 210 * shouldn't be a problem. */ 186 211 #endif /* __rtems__ */ 187 212 … … 219 244 MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); 220 245 246 #ifdef __rtems__ 247 dwRegionBaseAddr = 248 SYSTEM_START_ADDRESS | 249 MPU_REGION_VALID | 250 MPU_SYSTEM_REGION; 251 252 dwRegionAttr = MPU_AP_FULL_ACCESS | 253 MPU_REGION_EXECUTE_NEVER | 254 SHAREABLE_DEVICE_TYPE | 255 MPU_CalMPURegionSize(SYSTEM_END_ADDRESS - SYSTEM_START_ADDRESS) 256 | MPU_REGION_ENABLE; 257 258 MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); 259 #endif /* __rtems__ */ 221 260 222 261 /**************************************************** … … 268 307 MPU_QSPIMEM_REGION; //8 269 308 309 #ifdef __rtems__ 310 if (QSPI_END_ADDRESS + 1 != QSPI_START_ADDRESS) { 311 #endif /* __rtems__ */ 270 312 dwRegionAttr = 271 313 MPU_AP_FULL_ACCESS | … … 273 315 MPU_CalMPURegionSize(QSPI_END_ADDRESS - QSPI_START_ADDRESS) | 274 316 MPU_REGION_ENABLE; 317 #ifdef __rtems__ 318 } else { 319 dwRegionAttr = MPU_REGION_DISABLE; 320 } 321 #endif /* __rtems__ */ 275 322 276 323 MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); … … 302 349 303 350 /* Enable the MPU region */ 351 #ifndef __rtems__ 304 352 MPU_Enable(MPU_ENABLE | MPU_PRIVDEFENA); 353 #else /* __rtems__ */ 354 MPU_Enable(MPU_ENABLE); 355 #endif /* __rtems__ */ 305 356 306 357 memory_sync(); -
c/src/lib/libbsp/arm/atsam/libraries/libchip/include/mpu.h
rbdbf1ffa rf7f420e 55 55 #define MPU_NOCACHE_SRAM_REGION (11) 56 56 #endif 57 #define MPU_SYSTEM_REGION (12) 57 58 58 59 #define MPU_REGION_VALID (0x10) … … 102 103 103 104 /********* IFLASH memory macros *********************/ 105 #ifdef __rtems__ 106 #define ITCM_START_ADDRESS ((uintptr_t) atsam_memory_itcm_begin) 107 #define ITCM_END_ADDRESS ((uintptr_t) atsam_memory_itcm_end - 1) 108 #define IFLASH_START_ADDRESS ((uintptr_t) atsam_memory_intflash_begin) 109 #define IFLASH_END_ADDRESS ((uintptr_t) atsam_memory_intflash_end - 1) 110 #else /* !__rtems__ */ 104 111 #define ITCM_START_ADDRESS 0x00000000UL 105 112 #define ITCM_END_ADDRESS 0x003FFFFFUL 106 113 #define IFLASH_START_ADDRESS 0x00400000UL 107 114 #define IFLASH_END_ADDRESS 0x005FFFFFUL 115 #endif /* __rtems__ */ 108 116 109 117 … … 115 123 116 124 /**************** DTCM *******************************/ 125 #ifdef __rtems__ 126 #define DTCM_START_ADDRESS ((uintptr_t) atsam_memory_dtcm_begin) 127 #define DTCM_END_ADDRESS ((uintptr_t) atsam_memory_dtcm_end - 1) 128 #else /* !__rtems__ */ 117 129 #define DTCM_START_ADDRESS 0x20000000UL 118 130 #define DTCM_END_ADDRESS 0x203FFFFFUL 131 #endif /* __rtems__ */ 119 132 120 133 121 134 /******* SRAM memory macros ***************************/ 122 135 136 #ifdef __rtems__ 137 #define SRAM_START_ADDRESS ((uintptr_t) atsam_memory_intsram_begin) 138 #define SRAM_END_ADDRESS ((uintptr_t) atsam_memory_intsram_end - 1) 139 #else /* !__rtems__ */ 123 140 #define SRAM_START_ADDRESS 0x20400000UL 124 141 #define SRAM_END_ADDRESS 0x2045FFFFUL 125 142 #endif /* __rtems__ */ 143 144 #ifndef __rtems__ 126 145 #if defined MPU_HAS_NOCACHE_REGION 127 146 #define NOCACHE_SRAM_REGION_SIZE 0x1000 128 147 #endif 148 #endif /* __rtems__ */ 129 149 130 150 /* Regions should be a 2^(N+1) where 4 < N < 31 */ 131 151 #ifdef __rtems__ 132 #define SRAM_FIRST_START_ADDRESS ((uintptr_t) atsam_memory_ sdram_begin)133 #define SRAM_FIRST_END_ADDRESS ((uintptr_t) atsam_memory_ sdram_end - 1)134 #else /* __rtems__ */152 #define SRAM_FIRST_START_ADDRESS ((uintptr_t) atsam_memory_intsram_begin) 153 #define SRAM_FIRST_END_ADDRESS ((uintptr_t) atsam_memory_intsram_end - 1) 154 #else /* !__rtems__ */ 135 155 #define SRAM_FIRST_START_ADDRESS (SRAM_START_ADDRESS) 136 156 #define SRAM_FIRST_END_ADDRESS (SRAM_FIRST_START_ADDRESS + 0x3FFFF) // (2^18) 256 KB … … 141 161 #define SRAM_NOCACHE_START_ADDRESS ((uintptr_t) atsam_memory_nocache_begin) 142 162 #define SRAM_NOCACHE_END_ADDRESS ((uintptr_t) atsam_memory_nocache_end - 1) 143 #else /* __rtems__ */ 163 #define NOCACHE_SRAM_REGION_SIZE (SRAM_NOCACHE_END_ADDRESS - SRAM_NOCACHE_START_ADDRESS) 164 #else /* !__rtems__ */ 144 165 #define SRAM_SECOND_START_ADDRESS (SRAM_FIRST_END_ADDRESS+1) 145 166 #define SRAM_SECOND_END_ADDRESS (SRAM_END_ADDRESS - NOCACHE_SRAM_REGION_SIZE) // (2^17) 128 - 0x1000 KB … … 156 177 #define PERIPHERALS_START_ADDRESS 0x40000000UL 157 178 #define PERIPHERALS_END_ADDRESS 0x5FFFFFFFUL 179 #ifdef __rtems__ 180 #define SYSTEM_START_ADDRESS 0xE0000000UL 181 #define SYSTEM_END_ADDRESS 0xFFFFFFFFUL 182 #endif /* __rtems__ */ 158 183 159 184 /******* Ext EBI memory macros ***************************/ … … 162 187 163 188 /******* Ext-SRAM memory macros ***************************/ 189 #ifdef __rtems__ 190 #define SDRAM_START_ADDRESS ((uintptr_t) atsam_memory_sdram_begin) 191 #define SDRAM_END_ADDRESS ((uintptr_t) atsam_memory_sdram_end - 1) 192 #else /* !__rtems__ */ 164 193 #define SDRAM_START_ADDRESS 0x70000000UL 165 194 #define SDRAM_END_ADDRESS 0x7FFFFFFFUL 195 #endif /* __rtems__ */ 166 196 167 197 /******* QSPI macros ***************************/ 198 #ifdef __rtems__ 199 #define QSPI_START_ADDRESS ((uintptr_t) atsam_memory_qspiflash_begin) 200 #define QSPI_END_ADDRESS ((uintptr_t) atsam_memory_qspiflash_end - 1) 201 #else /* !__rtems__ */ 168 202 #define QSPI_START_ADDRESS 0x80000000UL 169 203 #define QSPI_END_ADDRESS 0x9FFFFFFFUL 204 #endif /* __rtems__ */ 170 205 171 206 /************** USBHS_RAM region macros ******************/ -
c/src/lib/libbsp/arm/atsam/startup/linkcmds.memory.in
rbdbf1ffa rf7f420e 8 8 QSPIFLASH : ORIGIN = 0x80000000, LENGTH = @ATSAM_MEMORY_QSPIFLASH_SIZE@ 9 9 } 10 11 /* Must be used only for MPU definitions */ 10 12 11 13 atsam_memory_itcm_begin = ORIGIN (ITCM);
Note: See TracChangeset
for help on using the changeset viewer.