├── .gitattributes ├── MemoryViewer.jar ├── README.md ├── examples ├── example.png ├── example_lpc.map └── example_stm.map └── src └── MemoryViewer ├── MemoryConfiguration ├── MemoryConfiguration.java ├── MemoryConfigurationLoader.java ├── Space.java └── SpaceAttributes.java ├── MemoryConfigurationAndContentsComponent.java ├── MemoryConfigurationSelectionListener.java ├── MemoryContents ├── DataContent.java ├── FillContent.java ├── IdentifierContent.java ├── MemoryContent.java ├── MemoryContents.java └── MemoryContentsLoader.java ├── MemoryDetailsComponent.java ├── MemoryDetailsListener.java ├── MemoryInfoFactory.java ├── MemoryInfoUpdateListener.java ├── MemoryMap ├── MemoryMap.java ├── MemoryMapCompressor.java ├── MemoryMapFilter.java ├── MemoryMapLoader.java ├── Region.java ├── RegionData.java └── SubRegion.java ├── MemoryMapComponent.java ├── MemoryViewer.java └── MemoryViewerMenu.java /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /MemoryViewer.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpgvandijk/linker-map-viewer/2584a76b5d2d34af12b7d1f0cae228484ff4feb2/MemoryViewer.jar -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | linker-map-viewer 2 | ================= 3 | 4 | Browser/viewer for the .map file generated by the gnu ld linker. 5 | 6 | Features: 7 | - Memory Configuration viewer showing all available memories. 8 | - Memory Contents viewer showing all defined identifiers and data/fill parts for the memories selected in the memory configuration viewer. 9 | - Memory Tree viewer showing the subregions in every region, and all data in each subregion 10 | - Memory Picture visualizing the region selected in the memory tree, highlighting the selected subregion/data 11 | - Memory Details viewer showing the details of any item clicked on in either the memory configuration viewer, memory contents viewer or memory tree viewer. 12 | 13 | Examples are added in the "examples" directory. 14 | 15 | ![Example Screenshot](https://raw.githubusercontent.com/jpgvandijk/linker-map-viewer/master/examples/example.png) 16 | -------------------------------------------------------------------------------- /examples/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpgvandijk/linker-map-viewer/2584a76b5d2d34af12b7d1f0cae228484ff4feb2/examples/example.png -------------------------------------------------------------------------------- /examples/example_lpc.map: -------------------------------------------------------------------------------- 1 | 2 | Allocating common symbols 3 | Common symbol size file 4 | 5 | OneWireTaskAndStatus 6 | 0x4 ./src/test/onewire_test.o 7 | 8 | Discarded input sections 9 | 10 | .text 0x00000000 0x0 ./src/test/heap_test.o 11 | .data 0x00000000 0x0 ./src/test/heap_test.o 12 | .bss 0x00000000 0x0 ./src/test/heap_test.o 13 | .bss.KERNEL_Heap 14 | 0x00000000 0x800 ./src/test/heap_test.o 15 | .text.DEBUG_HeapUpdate 16 | 0x00000000 0x54 ./src/test/heap_test.o 17 | .bss.DEBUG_HeapPointers 18 | 0x00000000 0x400 ./src/test/heap_test.o 19 | .text.DEBUG_HeapTest 20 | 0x00000000 0x84 ./src/test/heap_test.o 21 | .text.DEBUG_HeapTestMerge 22 | 0x00000000 0x4c ./src/test/heap_test.o 23 | .ARM.attributes 24 | 0x00000000 0x21 ./src/test/heap_test.o 25 | .debug_line 0x00000000 0xcb ./src/test/heap_test.o 26 | .debug_info 0x00000000 0x89 ./src/test/heap_test.o 27 | .debug_abbrev 0x00000000 0x12 ./src/test/heap_test.o 28 | .debug_aranges 29 | 0x00000000 0x30 ./src/test/heap_test.o 30 | .debug_ranges 0x00000000 0x28 ./src/test/heap_test.o 31 | .group 0x00000000 0x8 ./src/test/onewire_test.o 32 | .group 0x00000000 0x8 ./src/test/onewire_test.o 33 | .group 0x00000000 0x8 ./src/test/onewire_test.o 34 | .group 0x00000000 0x8 ./src/test/onewire_test.o 35 | .group 0x00000000 0x8 ./src/test/onewire_test.o 36 | .group 0x00000000 0x8 ./src/test/onewire_test.o 37 | .group 0x00000000 0x8 ./src/test/onewire_test.o 38 | .data 0x00000000 0x0 ./src/test/onewire_test.o 39 | .bss 0x00000000 0x0 ./src/test/onewire_test.o 40 | .group 0x00000000 0x8 ./src/test/spi1_flash_test.o 41 | .text 0x00000000 0x0 ./src/test/spi1_flash_test.o 42 | .data 0x00000000 0x0 ./src/test/spi1_flash_test.o 43 | .bss 0x00000000 0x0 ./src/test/spi1_flash_test.o 44 | .debug_info 0x00000000 0x21 ./src/test/spi1_flash_test.o 45 | .debug_abbrev 0x00000000 0x13 ./src/test/spi1_flash_test.o 46 | .debug_aranges 47 | 0x00000000 0x18 ./src/test/spi1_flash_test.o 48 | .debug_macro 0x00000000 0x11 ./src/test/spi1_flash_test.o 49 | .debug_macro 0x00000000 0x844 ./src/test/spi1_flash_test.o 50 | .debug_line 0x00000000 0x3e ./src/test/spi1_flash_test.o 51 | .debug_str 0x00000000 0x2395 ./src/test/spi1_flash_test.o 52 | .comment 0x00000000 0x71 ./src/test/spi1_flash_test.o 53 | .ARM.attributes 54 | 0x00000000 0x33 ./src/test/spi1_flash_test.o 55 | .group 0x00000000 0x8 ./src/test/tft_test.o 56 | .text 0x00000000 0x0 ./src/test/tft_test.o 57 | .data 0x00000000 0x0 ./src/test/tft_test.o 58 | .bss 0x00000000 0x0 ./src/test/tft_test.o 59 | .debug_info 0x00000000 0x21 ./src/test/tft_test.o 60 | .debug_abbrev 0x00000000 0x13 ./src/test/tft_test.o 61 | .debug_aranges 62 | 0x00000000 0x18 ./src/test/tft_test.o 63 | .debug_macro 0x00000000 0x11 ./src/test/tft_test.o 64 | .debug_macro 0x00000000 0x844 ./src/test/tft_test.o 65 | .debug_line 0x00000000 0x37 ./src/test/tft_test.o 66 | .debug_str 0x00000000 0x238e ./src/test/tft_test.o 67 | .comment 0x00000000 0x71 ./src/test/tft_test.o 68 | .ARM.attributes 69 | 0x00000000 0x33 ./src/test/tft_test.o 70 | .text 0x00000000 0x0 ./src/lpc/main.o 71 | .data 0x00000000 0x0 ./src/lpc/main.o 72 | .bss 0x00000000 0x0 ./src/lpc/main.o 73 | .text 0x00000000 0x0 ./src/lpc/pin.o 74 | .data 0x00000000 0x0 ./src/lpc/pin.o 75 | .bss 0x00000000 0x0 ./src/lpc/pin.o 76 | .text 0x00000000 0x0 ./src/lpc/system.o 77 | .data 0x00000000 0x0 ./src/lpc/system.o 78 | .bss 0x00000000 0x0 ./src/lpc/system.o 79 | .text.SystemDelayMs 80 | 0x00000000 0xe ./src/lpc/system.o 81 | .text.SystemDisablePeripheral 82 | 0x00000000 0x10 ./src/lpc/system.o 83 | .text 0x00000000 0x0 ./src/cortex_m3.o 84 | .data 0x00000000 0x0 ./src/cortex_m3.o 85 | .bss 0x00000000 0x0 ./src/cortex_m3.o 86 | .text.NVIC_IRQPriority 87 | 0x00000000 0x14 ./src/cortex_m3.o 88 | .text.NVIC_IRQTrigger 89 | 0x00000000 0xc ./src/cortex_m3.o 90 | .text 0x00000000 0x0 ./src/helper.o 91 | .data 0x00000000 0x0 ./src/helper.o 92 | .bss 0x00000000 0x0 ./src/helper.o 93 | .text 0x00000000 0x0 ./src/kernel_exceptions.o 94 | .data 0x00000000 0x0 ./src/kernel_exceptions.o 95 | .bss 0x00000000 0x0 ./src/kernel_exceptions.o 96 | .text 0x00000000 0x0 ./src/kernel_exclusiveaccess.o 97 | .data 0x00000000 0x0 ./src/kernel_exclusiveaccess.o 98 | .bss 0x00000000 0x0 ./src/kernel_exclusiveaccess.o 99 | .text 0x00000000 0x0 ./src/kernel_heap.o 100 | .data 0x00000000 0x0 ./src/kernel_heap.o 101 | .bss 0x00000000 0x0 ./src/kernel_heap.o 102 | .text 0x00000000 0x0 ./src/kernel_scheduler.o 103 | .data 0x00000000 0x0 ./src/kernel_scheduler.o 104 | .bss 0x00000000 0x0 ./src/kernel_scheduler.o 105 | .text 0x00000000 0x0 ./src/onewire.o 106 | .data 0x00000000 0x0 ./src/onewire.o 107 | .bss 0x00000000 0x0 ./src/onewire.o 108 | .text 0x00000000 0x0 ./src/startup.o 109 | .data 0x00000000 0x0 ./src/startup.o 110 | .bss 0x00000000 0x0 ./src/startup.o 111 | 112 | Memory Configuration 113 | 114 | Name Origin Length Attributes 115 | FlashMemory 0x00000000 0x00080000 xr 116 | LocalSRAM 0x10000000 0x00008000 xrw 117 | AHBSRAM 0x2007c000 0x00008000 xrw 118 | *default* 0x00000000 0xffffffff 119 | 120 | Linker script and memory map 121 | 122 | LOAD ./src/test/heap_test.o 123 | LOAD ./src/test/onewire_test.o 124 | LOAD ./src/test/spi1_flash_test.o 125 | LOAD ./src/test/tft_test.o 126 | LOAD ./src/lpc/main.o 127 | LOAD ./src/lpc/pin.o 128 | LOAD ./src/lpc/system.o 129 | LOAD ./src/cortex_m3.o 130 | LOAD ./src/helper.o 131 | LOAD ./src/kernel_exceptions.o 132 | LOAD ./src/kernel_exclusiveaccess.o 133 | LOAD ./src/kernel_heap.o 134 | LOAD ./src/kernel_scheduler.o 135 | LOAD ./src/onewire.o 136 | LOAD ./src/startup.o 137 | 0x00080000 __top_FlashMemory = 0x80000 138 | 0x10008000 __top_LocalSRAM = 0x10008000 139 | 0x20084000 __top_AHBSRAM = 0x20084000 140 | 141 | .text 0x00000000 0xc40 142 | FILL mask 0xff 143 | 0x00000000 . = 0x0 144 | *(.interrupt_vectors) 145 | .interrupt_vectors 146 | 0x00000000 0xcc ./src/startup.o 147 | 0x00000000 InterruptVectors 148 | 0x000000cc . = ALIGN (0x4) 149 | *(.section_table) 150 | .section_table 151 | 0x000000cc 0x28 ./src/startup.o 152 | 0x000000cc SectionTable 153 | 0x000000f4 . = ALIGN (0x4) 154 | *(.after_vectors*) 155 | .after_vectors.DefaultExceptionHandlers 156 | 0x000000f4 0x2 ./src/startup.o 157 | 0x000000f4 HardFault_Handler 158 | 0x000000f4 NMI_Handler 159 | 0x000000f4 UsageFault_Handler 160 | 0x000000f4 MemManage_Handler 161 | 0x000000f4 BusFault_Handler 162 | 0x000000f4 DebugMon_Handler 163 | .after_vectors.DefaultInterruptHandlers 164 | 0x000000f6 0x2 ./src/startup.o 165 | 0x000000f6 TIMER2_IRQHandler 166 | 0x000000f6 RIT_IRQHandler 167 | 0x000000f6 I2C0_IRQHandler 168 | 0x000000f6 USBActivity_IRQHandler 169 | 0x000000f6 PWM1_IRQHandler 170 | 0x000000f6 I2C1_IRQHandler 171 | 0x000000f6 EINT2_IRQHandler 172 | 0x000000f6 UART1_IRQHandler 173 | 0x000000f6 EINT3_IRQHandler 174 | 0x000000f6 CANActivity_IRQHandler 175 | 0x000000f6 TIMER3_IRQHandler 176 | 0x000000f6 UART0_IRQHandler 177 | 0x000000f6 PLL0_IRQHandler 178 | 0x000000f6 CAN_IRQHandler 179 | 0x000000f6 PLL1_IRQHandler 180 | 0x000000f6 SSP0_IRQHandler 181 | 0x000000f6 I2S_IRQHandler 182 | 0x000000f6 I2C2_IRQHandler 183 | 0x000000f6 RTC_IRQHandler 184 | 0x000000f6 SPI_IRQHandler 185 | 0x000000f6 EINT1_IRQHandler 186 | 0x000000f6 TIMER1_IRQHandler 187 | 0x000000f6 UART2_IRQHandler 188 | 0x000000f6 ADC_IRQHandler 189 | 0x000000f6 SSP1_IRQHandler 190 | 0x000000f6 USB_IRQHandler 191 | 0x000000f6 BOD_IRQHandler 192 | 0x000000f6 WDT_IRQHandler 193 | 0x000000f6 QEI_IRQHandler 194 | 0x000000f6 EINT0_IRQHandler 195 | 0x000000f6 DMA_IRQHandler 196 | 0x000000f6 UART3_IRQHandler 197 | 0x000000f6 MCPWM_IRQHandler 198 | 0x000000f6 ENET_IRQHandler 199 | .after_vectors.InitDataSection 200 | 0x000000f8 0xe ./src/startup.o 201 | 0x00000100 InitDataSection 202 | .after_vectors.InitBssSection 203 | 0x00000106 0xa ./src/startup.o 204 | 0x0000010a InitBssSection 205 | .after_vectors.Reset_Handler 206 | 0x00000110 0x48 ./src/startup.o 207 | 0x00000110 Reset_Handler 208 | 0x000002fc . = 0x2fc 209 | *fill* 0x00000158 0x1a4 ff 210 | *(.crp) 211 | .crp 0x000002fc 0x4 ./src/startup.o 212 | 0x000002fc CRPWord 213 | *(.text*) 214 | .text 0x00000300 0xc4 ./src/test/onewire_test.o 215 | 0x00000304 TaskOWPerformance 216 | 0x00000314 TaskOW 217 | 0x00000384 OneWireCallbackFunction 218 | 0x0000039c onewire_test 219 | .text.main 0x000003c4 0xe ./src/lpc/main.o 220 | 0x000003c4 main 221 | .text.main_BOD 222 | 0x000003d2 0x2 ./src/lpc/main.o 223 | 0x000003d2 main_BOD 224 | .text.main_WDT 225 | 0x000003d4 0x2 ./src/lpc/main.o 226 | 0x000003d4 main_WDT 227 | *fill* 0x000003d6 0x2 228 | .text.PinConfig 229 | 0x000003d8 0x38 ./src/lpc/pin.o 230 | 0x000003d8 PIN_SetInputMode 231 | 0x000003da PIN_SetFunction 232 | 0x000003f6 PIN_SetOutputMode 233 | 0x00000402 PIN_SetI2C0PinConfiguration 234 | .text.SystemInitClock 235 | 0x00000410 0x68 ./src/lpc/system.o 236 | 0x00000410 SystemInitClock 237 | .text.SystemGetClock 238 | 0x00000478 0x58 ./src/lpc/system.o 239 | 0x00000478 SystemGetClock 240 | .text.SystemInitPeripheral 241 | 0x000004d0 0x30 ./src/lpc/system.o 242 | 0x000004d0 SystemInitPeripheral 243 | .text.NVIC_IRQControlStatusBits 244 | 0x00000500 0x3c ./src/cortex_m3.o 245 | 0x00000500 NVIC_IRQClearPending 246 | 0x00000504 NVIC_IRQSetPending 247 | 0x00000508 NVIC_IRQDisable 248 | 0x0000050c NVIC_IRQEnable 249 | 0x0000051c NVIC_IRQIsActive 250 | 0x00000520 NVIC_IRQIsPending 251 | 0x00000524 NVIC_IRQIsEnabled 252 | .text.NVIC_EXCControlStatusBits 253 | 0x0000053c 0x40 ./src/cortex_m3.o 254 | 0x0000053c NVIC_EXCSetPendingNMI 255 | 0x00000542 NVIC_EXCClearPendingSysTick 256 | 0x00000548 NVIC_EXCSetPendingSysTick 257 | 0x0000054e NVIC_EXCClearPendingPendSV 258 | 0x00000554 NVIC_EXCSetPendingPendSV 259 | 0x0000055e NVIC_EXCIsPendingNMI 260 | 0x00000564 NVIC_EXCIsPendingSysTick 261 | 0x0000056a NVIC_EXCIsPendingPendSV 262 | .text.NVIC_EXCPriority 263 | 0x0000057c 0x14 ./src/cortex_m3.o 264 | 0x0000057c NVIC_EXCSetPriority 265 | 0x00000584 NVIC_EXCGetPriority 266 | .text.NVIC_ControlFunctions 267 | 0x00000590 0x28 ./src/cortex_m3.o 268 | 0x00000590 NVIC_SetPriorityGrouping 269 | 0x0000059c NVIC_SystemReset 270 | .text.NumberToBitInWord 271 | 0x000005b8 0x10 ./src/helper.o 272 | 0x000005b8 NumberTo4BitsInWord 273 | 0x000005ba NumberTo2BitsInWord 274 | 0x000005bc NumberToBitInWord 275 | .text.SVC_Handler 276 | 0x000005c8 0xd4 ./src/kernel_exceptions.o 277 | 0x000005c8 SVC_Handler 278 | .text.SysTick_Handler 279 | 0x0000069c 0x5c ./src/kernel_exceptions.o 280 | 0x0000069c SysTick_Handler 281 | .text.PendSV_Handler 282 | 0x000006f8 0x34 ./src/kernel_exceptions.o 283 | 0x000006f8 PendSV_Handler 284 | .text.KERNEL_GetExclusiveAccess 285 | 0x0000072c 0x16 ./src/kernel_exclusiveaccess.o 286 | 0x0000072c KERNEL_GetExclusiveAccess 287 | .text.KERNEL_ClearExclusiveAccess 288 | 0x00000742 0x6 ./src/kernel_exclusiveaccess.o 289 | 0x00000742 KERNEL_ClearExclusiveAccess 290 | .text.HeapManagement 291 | 0x00000748 0xa0 ./src/kernel_heap.o 292 | 0x00000748 KERNEL_InitHeap 293 | 0x0000075a KERNEL_Alloc 294 | 0x00000798 KERNEL_Free 295 | .text.KERNEL_Init 296 | 0x000007e8 0x30 ./src/kernel_scheduler.o 297 | 0x000007e8 KERNEL_Init 298 | .text.KERNEL_AddTask 299 | 0x00000818 0x60 ./src/kernel_scheduler.o 300 | 0x00000818 KERNEL_AddTask 301 | .text.KERNEL_AddTaskToReadyList 302 | 0x00000878 0x20 ./src/kernel_scheduler.o 303 | 0x00000878 KERNEL_AddTaskToReadyList 304 | .text.KERNEL_RemoveTaskFromReadyList 305 | 0x00000898 0x30 ./src/kernel_scheduler.o 306 | 0x00000898 KERNEL_RemoveTaskFromReadyList 307 | .text.KERNEL_AddTaskToDelayedList 308 | 0x000008c8 0x20 ./src/kernel_scheduler.o 309 | 0x000008c8 KERNEL_AddTaskToDelayedList 310 | .text.KERNEL_RemoveTaskFromDelayedList 311 | 0x000008e8 0x24 ./src/kernel_scheduler.o 312 | 0x000008e8 KERNEL_RemoveTaskFromDelayedList 313 | .text.KERNEL_Start 314 | 0x0000090c 0x4c ./src/kernel_scheduler.o 315 | 0x0000090c KERNEL_Start 316 | .text.KERNEL_TaskIdle 317 | 0x00000958 0x4 ./src/kernel_scheduler.o 318 | 0x00000958 KERNEL_TaskIdle 319 | .text.KERNEL_KillTask 320 | 0x0000095c 0x8 ./src/kernel_scheduler.o 321 | 0x0000095c KERNEL_KillTask 322 | .text.TIMER0_IRQHandler 323 | 0x00000964 0xf8 ./src/onewire.o 324 | 0x00000964 TIMER0_IRQHandler 325 | .text.OW_StartTransfer 326 | 0x00000a5c 0x40 ./src/onewire.o 327 | 0x00000a5c OW_StartTransfer 328 | .text.OW_Init 0x00000a9c 0x34 ./src/onewire.o 329 | 0x00000a9c OW_Init 330 | .text.OW_InitPin 331 | 0x00000ad0 0x38 ./src/onewire.o 332 | 0x00000ad0 OW_InitPin 333 | .text.OWSearch_InitReset 334 | 0x00000b08 0xc ./src/onewire.o 335 | 0x00000b08 OWSearch_Init 336 | 0x00000b08 OWSearch_Reset 337 | .text.OWSearch_Next 338 | 0x00000b14 0x30 ./src/onewire.o 339 | 0x00000b14 OWSearch_Next 340 | .text.OWSearch_Algorithm 341 | 0x00000b44 0xa0 ./src/onewire.o 342 | 0x00000b44 OWSearch_Algorithm 343 | .text.OW_CheckCRC8 344 | 0x00000be4 0x2a ./src/onewire.o 345 | 0x00000be4 OW_CheckCRC8 346 | *(.rodata .rodata.*) 347 | *fill* 0x00000c0e 0x2 348 | .rodata 0x00000c10 0x20 ./src/test/onewire_test.o 349 | 0x00000c10 TaskDescriptor_TaskOW 350 | 0x00000c20 TaskDescriptor_TaskOWPerformance 351 | .rodata.TaskDescriptors 352 | 0x00000c30 0x10 ./src/kernel_scheduler.o 353 | 0x00000c30 KERNEL_TaskIdleDescriptor 354 | 0x00000c40 . = ALIGN (0x4) 355 | 356 | .glue_7 0x00000c40 0x0 357 | .glue_7 0x00000000 0x0 linker stubs 358 | 359 | .glue_7t 0x00000c40 0x0 360 | .glue_7t 0x00000000 0x0 linker stubs 361 | 362 | .vfp11_veneer 0x00000c40 0x0 363 | .vfp11_veneer 0x00000000 0x0 linker stubs 364 | 365 | .v4_bx 0x00000c40 0x0 366 | .v4_bx 0x00000000 0x0 linker stubs 367 | 368 | .iplt 0x00000c40 0x0 369 | .iplt 0x00000000 0x0 ./src/test/heap_test.o 370 | 371 | .rel.dyn 0x00000c40 0x0 372 | .rel.iplt 0x00000000 0x0 ./src/test/heap_test.o 373 | 374 | .data_AHB 0x2007c000 0x0 load address 0x00000c40 375 | FILL mask 0xff 376 | *(.data.AHB*) 377 | 0x2007c000 . = ALIGN (0x4) 378 | 0x00000000 __data_AHB_Size = SIZEOF (.data_AHB) 379 | 0x00000c40 __data_AHB_LoadAddress = LOADADDR (.data_AHB) 380 | 0x2007c000 __data_AHB_StartAddress = ADDR (.data_AHB) 381 | 0x2007c000 __data_AHB_EndAddress = (ADDR (.data_AHB) + SIZEOF (.data_AHB)) 382 | 383 | .data 0x10000000 0x0 load address 0x00000c40 384 | FILL mask 0xff 385 | *(.data*) 386 | 0x10000000 . = ALIGN (0x4) 387 | 0x00000000 __data_Size = SIZEOF (.data) 388 | 0x00000c40 __data_LoadAddress = LOADADDR (.data) 389 | 0x10000000 __data_StartAddress = ADDR (.data) 390 | 0x10000000 __data_EndAddress = (ADDR (.data) + SIZEOF (.data)) 391 | 392 | .igot.plt 0x10000000 0x0 load address 0x00000c40 393 | .igot.plt 0x00000000 0x0 ./src/test/heap_test.o 394 | 395 | .bss_AHB 0x2007c000 0x28 396 | *(.bss.bitband*) 397 | .bss.bitband.OW_TransferBuffers 398 | 0x2007c000 0x20 ./src/onewire.o 399 | 0x2007c000 OW_TransferWriteBuffer 400 | 0x2007c000 OW_TransferBuffers 401 | 0x2007c010 OW_TransferReadBuffer 402 | .bss.bitband.OWSearch_ROM 403 | 0x2007c020 0x8 ./src/onewire.o 404 | 0x2007c020 OWSearch_ROM 405 | *(.bss.AHB*) 406 | 0x2007c028 . = ALIGN (0x4) 407 | 0x00000028 __bss_AHB_Size = SIZEOF (.bss_AHB) 408 | 0x2007c000 __bss_AHB_StartAddress = ADDR (.bss_AHB) 409 | 0x2007c028 __bss_AHB_EndAddress = (ADDR (.bss_AHB) + SIZEOF (.bss_AHB)) 410 | 411 | .bss 0x10000000 0x8e8 412 | *(.bss*) 413 | .bss.SystemClock 414 | 0x10000000 0x4 ./src/lpc/system.o 415 | 0x10000000 SystemClock 416 | .bss.KERNEL_Time 417 | 0x10000004 0x8 ./src/kernel_exceptions.o 418 | 0x10000004 KERNEL_Time 419 | .bss.KERNEL_Heap 420 | 0x1000000c 0x800 ./src/kernel_heap.o 421 | 0x1000000c KERNEL_Heap 422 | .bss.KERNEL_HeapEmptyList 423 | 0x1000080c 0x4 ./src/kernel_heap.o 424 | 0x1000080c KERNEL_HeapEmptyList 425 | .bss.KERNEL_TaskTable 426 | 0x10000810 0xa0 ./src/kernel_scheduler.o 427 | 0x10000810 KERNEL_TaskTable 428 | .bss.KERNEL_TaskReadyLists 429 | 0x100008b0 0x10 ./src/kernel_scheduler.o 430 | 0x100008b0 KERNEL_TaskReadyLists 431 | .bss.KERNEL_TaskDelayedList 432 | 0x100008c0 0x8 ./src/kernel_scheduler.o 433 | 0x100008c0 KERNEL_TaskDelayedList 434 | 0x100008c4 KERNEL_TaskDelayedListOverflow 435 | .bss.KERNEL_TaskRunning 436 | 0x100008c8 0x4 ./src/kernel_scheduler.o 437 | 0x100008c8 KERNEL_TaskRunning 438 | .bss.OW_TransferData 439 | 0x100008cc 0x10 ./src/onewire.o 440 | 0x100008cc OW_TransferData 441 | 0x100008cc OW_TransferInternalCount 442 | 0x100008ce OW_TransferInternalStateAndLock 443 | 0x100008cf OW_TransferResetAndStatus 444 | 0x100008d0 OW_TransferWriteNBits 445 | 0x100008d2 OW_TransferReadNBits 446 | 0x100008d4 OW_TransferPin 447 | 0x100008d8 OW_TransferCallbackFunction 448 | .bss.OWSearch_Data 449 | 0x100008dc 0x8 ./src/onewire.o 450 | 0x100008dc OWSearch_Data 451 | 0x100008dc OWSearch_CallbackFunction 452 | 0x100008e0 OWSearch_CountAndStatus 453 | 0x100008e1 OWSearch_LastZero 454 | 0x100008e2 OWSearch_LastDiscrepancy 455 | 0x100008e4 . = ALIGN (0x4) 456 | COMMON 0x100008e4 0x4 ./src/test/onewire_test.o 457 | 0x100008e4 OneWireTaskAndStatus 458 | 0x000008e8 __bss_Size = SIZEOF (.bss) 459 | 0x10000000 __bss_StartAddress = ADDR (.bss) 460 | 0x100008e8 __bss_EndAddress = (ADDR (.bss) + SIZEOF (.bss)) 461 | 462 | .noinit_AHB 0x2007c028 0x0 463 | *(.noinit.bitband*) 464 | *(.noinit.AHB*) 465 | 0x2007c028 . = ALIGN (0x4) 466 | 467 | .noinit 0x100008e8 0x0 468 | *(.noinit*) 469 | 0x100008e8 . = ALIGN (0x4) 470 | OUTPUT(CM3_Assembly.axf elf32-littlearm) 471 | 472 | .debug_info 0x00000000 0xac3 473 | .debug_info 0x00000000 0x4f6 ./src/test/onewire_test.o 474 | .debug_info 0x000004f6 0x83 ./src/lpc/main.o 475 | .debug_info 0x00000579 0x86 ./src/lpc/pin.o 476 | .debug_info 0x000005ff 0x85 ./src/lpc/system.o 477 | .debug_info 0x00000684 0x84 ./src/cortex_m3.o 478 | .debug_info 0x00000708 0x85 ./src/helper.o 479 | .debug_info 0x0000078d 0x8c ./src/kernel_exceptions.o 480 | .debug_info 0x00000819 0x91 ./src/kernel_exclusiveaccess.o 481 | .debug_info 0x000008aa 0x8a ./src/kernel_heap.o 482 | .debug_info 0x00000934 0x8b ./src/kernel_scheduler.o 483 | .debug_info 0x000009bf 0x82 ./src/onewire.o 484 | .debug_info 0x00000a41 0x82 ./src/startup.o 485 | 486 | .debug_abbrev 0x00000000 0x29e 487 | .debug_abbrev 0x00000000 0x1d2 ./src/test/onewire_test.o 488 | .debug_abbrev 0x000001d2 0x12 ./src/lpc/main.o 489 | .debug_abbrev 0x000001e4 0x14 ./src/lpc/pin.o 490 | .debug_abbrev 0x000001f8 0x12 ./src/lpc/system.o 491 | .debug_abbrev 0x0000020a 0x12 ./src/cortex_m3.o 492 | .debug_abbrev 0x0000021c 0x14 ./src/helper.o 493 | .debug_abbrev 0x00000230 0x12 ./src/kernel_exceptions.o 494 | .debug_abbrev 0x00000242 0x12 ./src/kernel_exclusiveaccess.o 495 | .debug_abbrev 0x00000254 0x14 ./src/kernel_heap.o 496 | .debug_abbrev 0x00000268 0x12 ./src/kernel_scheduler.o 497 | .debug_abbrev 0x0000027a 0x12 ./src/onewire.o 498 | .debug_abbrev 0x0000028c 0x12 ./src/startup.o 499 | 500 | .debug_loc 0x00000000 0x8d 501 | .debug_loc 0x00000000 0x8d ./src/test/onewire_test.o 502 | 503 | .debug_aranges 0x00000000 0x288 504 | .debug_aranges 505 | 0x00000000 0x20 ./src/test/onewire_test.o 506 | .debug_aranges 507 | 0x00000020 0x30 ./src/lpc/main.o 508 | .debug_aranges 509 | 0x00000050 0x20 ./src/lpc/pin.o 510 | .debug_aranges 511 | 0x00000070 0x40 ./src/lpc/system.o 512 | .debug_aranges 513 | 0x000000b0 0x48 ./src/cortex_m3.o 514 | .debug_aranges 515 | 0x000000f8 0x20 ./src/helper.o 516 | .debug_aranges 517 | 0x00000118 0x30 ./src/kernel_exceptions.o 518 | .debug_aranges 519 | 0x00000148 0x28 ./src/kernel_exclusiveaccess.o 520 | .debug_aranges 521 | 0x00000170 0x20 ./src/kernel_heap.o 522 | .debug_aranges 523 | 0x00000190 0x60 ./src/kernel_scheduler.o 524 | .debug_aranges 525 | 0x000001f0 0x58 ./src/onewire.o 526 | .debug_aranges 527 | 0x00000248 0x40 ./src/startup.o 528 | 529 | .debug_macro 0x00000000 0x1358 530 | .debug_macro 0x00000000 0x5d ./src/test/onewire_test.o 531 | .debug_macro 0x0000005d 0x844 ./src/test/onewire_test.o 532 | .debug_macro 0x000008a1 0x16 ./src/test/onewire_test.o 533 | .debug_macro 0x000008b7 0x44 ./src/test/onewire_test.o 534 | .debug_macro 0x000008fb 0x209 ./src/test/onewire_test.o 535 | .debug_macro 0x00000b04 0x603 ./src/test/onewire_test.o 536 | .debug_macro 0x00001107 0x181 ./src/test/onewire_test.o 537 | .debug_macro 0x00001288 0xd0 ./src/test/onewire_test.o 538 | 539 | .debug_line 0x00000000 0xb72 540 | .debug_line 0x00000000 0x292 ./src/test/onewire_test.o 541 | .debug_line 0x00000292 0x63 ./src/lpc/main.o 542 | .debug_line 0x000002f5 0x5d ./src/lpc/pin.o 543 | .debug_line 0x00000352 0xf8 ./src/lpc/system.o 544 | .debug_line 0x0000044a 0xf0 ./src/cortex_m3.o 545 | .debug_line 0x0000053a 0x44 ./src/helper.o 546 | .debug_line 0x0000057e 0xfe ./src/kernel_exceptions.o 547 | .debug_line 0x0000067c 0x69 ./src/kernel_exclusiveaccess.o 548 | .debug_line 0x000006e5 0x93 ./src/kernel_heap.o 549 | .debug_line 0x00000778 0x16c ./src/kernel_scheduler.o 550 | .debug_line 0x000008e4 0x1eb ./src/onewire.o 551 | .debug_line 0x00000acf 0xa3 ./src/startup.o 552 | 553 | .debug_str 0x00000000 0x4c44 554 | .debug_str 0x00000000 0x4c44 ./src/test/onewire_test.o 555 | 0x4de3 (size before relaxing) 556 | 557 | .comment 0x00000000 0x70 558 | .comment 0x00000000 0x70 ./src/test/onewire_test.o 559 | 0x71 (size before relaxing) 560 | 561 | .ARM.attributes 562 | 0x00000000 0x2f 563 | .ARM.attributes 564 | 0x00000000 0x33 ./src/test/onewire_test.o 565 | .ARM.attributes 566 | 0x00000033 0x21 ./src/lpc/main.o 567 | .ARM.attributes 568 | 0x00000054 0x21 ./src/lpc/pin.o 569 | .ARM.attributes 570 | 0x00000075 0x21 ./src/lpc/system.o 571 | .ARM.attributes 572 | 0x00000096 0x21 ./src/cortex_m3.o 573 | .ARM.attributes 574 | 0x000000b7 0x21 ./src/helper.o 575 | .ARM.attributes 576 | 0x000000d8 0x21 ./src/kernel_exceptions.o 577 | .ARM.attributes 578 | 0x000000f9 0x21 ./src/kernel_exclusiveaccess.o 579 | .ARM.attributes 580 | 0x0000011a 0x21 ./src/kernel_heap.o 581 | .ARM.attributes 582 | 0x0000013b 0x21 ./src/kernel_scheduler.o 583 | .ARM.attributes 584 | 0x0000015c 0x21 ./src/onewire.o 585 | .ARM.attributes 586 | 0x0000017d 0x21 ./src/startup.o 587 | 588 | .debug_frame 0x00000000 0x88 589 | .debug_frame 0x00000000 0x88 ./src/test/onewire_test.o 590 | 591 | .debug_ranges 0x00000000 0x1c8 592 | .debug_ranges 0x00000000 0x28 ./src/lpc/main.o 593 | .debug_ranges 0x00000028 0x38 ./src/lpc/system.o 594 | .debug_ranges 0x00000060 0x40 ./src/cortex_m3.o 595 | .debug_ranges 0x000000a0 0x28 ./src/kernel_exceptions.o 596 | .debug_ranges 0x000000c8 0x20 ./src/kernel_exclusiveaccess.o 597 | .debug_ranges 0x000000e8 0x58 ./src/kernel_scheduler.o 598 | .debug_ranges 0x00000140 0x50 ./src/onewire.o 599 | .debug_ranges 0x00000190 0x38 ./src/startup.o 600 | -------------------------------------------------------------------------------- /examples/example_stm.map: -------------------------------------------------------------------------------- 1 | 2 | Allocating common symbols 3 | Common symbol size file 4 | 5 | OneWireTaskAndStatus 6 | 0x4 ./src/test/onewire_test.o 7 | buffer2 0x10 ./src/test/spi1_flash_test.o 8 | buffer1 0x4 ./src/test/spi1_flash_test.o 9 | buffer3 0x1 ./src/test/spi1_flash_test.o 10 | 11 | Discarded input sections 12 | 13 | .text 0x00000000 0x0 ./src/test/heap_test.o 14 | .data 0x00000000 0x0 ./src/test/heap_test.o 15 | .bss 0x00000000 0x0 ./src/test/heap_test.o 16 | .bss.KERNEL_Heap 17 | 0x00000000 0x800 ./src/test/heap_test.o 18 | .text.DEBUG_HeapUpdate 19 | 0x00000000 0x54 ./src/test/heap_test.o 20 | .bss.DEBUG_HeapPointers 21 | 0x00000000 0x400 ./src/test/heap_test.o 22 | .text.DEBUG_HeapTest 23 | 0x00000000 0x84 ./src/test/heap_test.o 24 | .text.DEBUG_HeapTestMerge 25 | 0x00000000 0x4c ./src/test/heap_test.o 26 | .ARM.attributes 27 | 0x00000000 0x21 ./src/test/heap_test.o 28 | .debug_line 0x00000000 0xcb ./src/test/heap_test.o 29 | .debug_info 0x00000000 0x89 ./src/test/heap_test.o 30 | .debug_abbrev 0x00000000 0x12 ./src/test/heap_test.o 31 | .debug_aranges 32 | 0x00000000 0x30 ./src/test/heap_test.o 33 | .debug_ranges 0x00000000 0x28 ./src/test/heap_test.o 34 | .group 0x00000000 0x8 ./src/test/onewire_test.o 35 | .group 0x00000000 0x8 ./src/test/onewire_test.o 36 | .group 0x00000000 0x8 ./src/test/onewire_test.o 37 | .group 0x00000000 0x8 ./src/test/onewire_test.o 38 | .group 0x00000000 0x8 ./src/test/onewire_test.o 39 | .group 0x00000000 0x8 ./src/test/onewire_test.o 40 | .group 0x00000000 0x8 ./src/test/onewire_test.o 41 | .text 0x00000000 0xc4 ./src/test/onewire_test.o 42 | .data 0x00000000 0x0 ./src/test/onewire_test.o 43 | .bss 0x00000000 0x0 ./src/test/onewire_test.o 44 | .rodata 0x00000000 0x20 ./src/test/onewire_test.o 45 | .debug_info 0x00000000 0x4f6 ./src/test/onewire_test.o 46 | .debug_abbrev 0x00000000 0x1d2 ./src/test/onewire_test.o 47 | .debug_loc 0x00000000 0x8d ./src/test/onewire_test.o 48 | .debug_aranges 49 | 0x00000000 0x20 ./src/test/onewire_test.o 50 | .debug_macro 0x00000000 0x5d ./src/test/onewire_test.o 51 | .debug_macro 0x00000000 0x844 ./src/test/onewire_test.o 52 | .debug_macro 0x00000000 0x16 ./src/test/onewire_test.o 53 | .debug_macro 0x00000000 0x44 ./src/test/onewire_test.o 54 | .debug_macro 0x00000000 0x209 ./src/test/onewire_test.o 55 | .debug_macro 0x00000000 0x798 ./src/test/onewire_test.o 56 | .debug_macro 0x00000000 0x181 ./src/test/onewire_test.o 57 | .debug_macro 0x00000000 0xd0 ./src/test/onewire_test.o 58 | .debug_line 0x00000000 0x296 ./src/test/onewire_test.o 59 | .debug_str 0x00000000 0x560f ./src/test/onewire_test.o 60 | .comment 0x00000000 0x71 ./src/test/onewire_test.o 61 | .ARM.attributes 62 | 0x00000000 0x33 ./src/test/onewire_test.o 63 | .debug_frame 0x00000000 0x88 ./src/test/onewire_test.o 64 | COMMON 0x00000000 0x4 ./src/test/onewire_test.o 65 | .group 0x00000000 0x8 ./src/test/spi1_flash_test.o 66 | .group 0x00000000 0x8 ./src/test/spi1_flash_test.o 67 | .group 0x00000000 0x8 ./src/test/spi1_flash_test.o 68 | .group 0x00000000 0x8 ./src/test/spi1_flash_test.o 69 | .group 0x00000000 0x8 ./src/test/spi1_flash_test.o 70 | .group 0x00000000 0x8 ./src/test/spi1_flash_test.o 71 | .group 0x00000000 0x8 ./src/test/spi1_flash_test.o 72 | .text 0x00000000 0x54 ./src/test/spi1_flash_test.o 73 | .data 0x00000000 0x0 ./src/test/spi1_flash_test.o 74 | .bss 0x00000000 0x0 ./src/test/spi1_flash_test.o 75 | .ext 0x00000000 0x8 ./src/test/spi1_flash_test.o 76 | .debug_info 0x00000000 0x238 ./src/test/spi1_flash_test.o 77 | .debug_abbrev 0x00000000 0xfc ./src/test/spi1_flash_test.o 78 | .debug_aranges 79 | 0x00000000 0x20 ./src/test/spi1_flash_test.o 80 | .debug_macro 0x00000000 0x7b ./src/test/spi1_flash_test.o 81 | .debug_macro 0x00000000 0x844 ./src/test/spi1_flash_test.o 82 | .debug_macro 0x00000000 0x16 ./src/test/spi1_flash_test.o 83 | .debug_macro 0x00000000 0x44 ./src/test/spi1_flash_test.o 84 | .debug_macro 0x00000000 0x209 ./src/test/spi1_flash_test.o 85 | .debug_macro 0x00000000 0x798 ./src/test/spi1_flash_test.o 86 | .debug_macro 0x00000000 0x181 ./src/test/spi1_flash_test.o 87 | .debug_macro 0x00000000 0x10 ./src/test/spi1_flash_test.o 88 | .debug_line 0x00000000 0x285 ./src/test/spi1_flash_test.o 89 | .debug_str 0x00000000 0x5032 ./src/test/spi1_flash_test.o 90 | .comment 0x00000000 0x71 ./src/test/spi1_flash_test.o 91 | .ARM.attributes 92 | 0x00000000 0x33 ./src/test/spi1_flash_test.o 93 | .debug_frame 0x00000000 0x28 ./src/test/spi1_flash_test.o 94 | COMMON 0x00000000 0x15 ./src/test/spi1_flash_test.o 95 | .group 0x00000000 0x8 ./src/test/tft_test.o 96 | .group 0x00000000 0x8 ./src/test/tft_test.o 97 | .group 0x00000000 0x8 ./src/test/tft_test.o 98 | .group 0x00000000 0x8 ./src/test/tft_test.o 99 | .group 0x00000000 0x8 ./src/test/tft_test.o 100 | .group 0x00000000 0x8 ./src/test/tft_test.o 101 | .group 0x00000000 0x8 ./src/test/tft_test.o 102 | .group 0x00000000 0x8 ./src/test/tft_test.o 103 | .group 0x00000000 0x8 ./src/test/tft_test.o 104 | .data 0x00000000 0x0 ./src/test/tft_test.o 105 | .bss 0x00000000 0x0 ./src/test/tft_test.o 106 | .debug_macro 0x00000000 0x844 ./src/test/tft_test.o 107 | .debug_macro 0x00000000 0x16 ./src/test/tft_test.o 108 | .debug_macro 0x00000000 0x44 ./src/test/tft_test.o 109 | .debug_macro 0x00000000 0x209 ./src/test/tft_test.o 110 | .debug_macro 0x00000000 0x798 ./src/test/tft_test.o 111 | .debug_macro 0x00000000 0x181 ./src/test/tft_test.o 112 | .debug_macro 0x00000000 0x10 ./src/test/tft_test.o 113 | .text 0x00000000 0x0 ./src/stm/flash.o 114 | .data 0x00000000 0x0 ./src/stm/flash.o 115 | .bss 0x00000000 0x0 ./src/stm/flash.o 116 | .text.FLASH_ReadByte 117 | 0x00000000 0x54 ./src/stm/flash.o 118 | .text 0x00000000 0x0 ./src/stm/main.o 119 | .data 0x00000000 0x0 ./src/stm/main.o 120 | .bss 0x00000000 0x0 ./src/stm/main.o 121 | .text 0x00000000 0x0 ./src/stm/pin.o 122 | .data 0x00000000 0x0 ./src/stm/pin.o 123 | .bss 0x00000000 0x0 ./src/stm/pin.o 124 | .text 0x00000000 0x0 ./src/stm/spi1.o 125 | .data 0x00000000 0x0 ./src/stm/spi1.o 126 | .bss 0x00000000 0x0 ./src/stm/spi1.o 127 | .text 0x00000000 0x0 ./src/stm/system.o 128 | .data 0x00000000 0x0 ./src/stm/system.o 129 | .bss 0x00000000 0x0 ./src/stm/system.o 130 | .text.SystemDelayMs 131 | 0x00000000 0xe ./src/stm/system.o 132 | .text.SystemDisablePeripheral 133 | 0x00000000 0x10 ./src/stm/system.o 134 | .text.SystemResetPeripheral 135 | 0x00000000 0x14 ./src/stm/system.o 136 | .text 0x00000000 0x0 ./src/stm/tft.o 137 | .data 0x00000000 0x0 ./src/stm/tft.o 138 | .bss 0x00000000 0x0 ./src/stm/tft.o 139 | .text 0x00000000 0x0 ./src/cortex_m3.o 140 | .data 0x00000000 0x0 ./src/cortex_m3.o 141 | .bss 0x00000000 0x0 ./src/cortex_m3.o 142 | .text.NVIC_IRQControlStatusBits 143 | 0x00000000 0x3c ./src/cortex_m3.o 144 | .text.NVIC_IRQPriority 145 | 0x00000000 0x14 ./src/cortex_m3.o 146 | .text.NVIC_IRQTrigger 147 | 0x00000000 0xc ./src/cortex_m3.o 148 | .text 0x00000000 0x0 ./src/helper.o 149 | .data 0x00000000 0x0 ./src/helper.o 150 | .bss 0x00000000 0x0 ./src/helper.o 151 | .text 0x00000000 0x0 ./src/kernel_exceptions.o 152 | .data 0x00000000 0x0 ./src/kernel_exceptions.o 153 | .bss 0x00000000 0x0 ./src/kernel_exceptions.o 154 | .text 0x00000000 0x0 ./src/kernel_exclusiveaccess.o 155 | .data 0x00000000 0x0 ./src/kernel_exclusiveaccess.o 156 | .bss 0x00000000 0x0 ./src/kernel_exclusiveaccess.o 157 | .text 0x00000000 0x0 ./src/kernel_heap.o 158 | .data 0x00000000 0x0 ./src/kernel_heap.o 159 | .bss 0x00000000 0x0 ./src/kernel_heap.o 160 | .text 0x00000000 0x0 ./src/kernel_scheduler.o 161 | .data 0x00000000 0x0 ./src/kernel_scheduler.o 162 | .bss 0x00000000 0x0 ./src/kernel_scheduler.o 163 | .text.KERNEL_RemoveTaskFromDelayedList 164 | 0x00000000 0x24 ./src/kernel_scheduler.o 165 | .text 0x00000000 0x0 ./src/onewire.o 166 | .data 0x00000000 0x0 ./src/onewire.o 167 | .bss 0x00000000 0x0 ./src/onewire.o 168 | .text.OW_StartTransfer 169 | 0x00000000 0x44 ./src/onewire.o 170 | .text.OW_Init 0x00000000 0x3c ./src/onewire.o 171 | .text.OW_InitPin 172 | 0x00000000 0x20 ./src/onewire.o 173 | .bss.OWSearch_Data 174 | 0x00000000 0x8 ./src/onewire.o 175 | .text.OWSearch_InitReset 176 | 0x00000000 0xc ./src/onewire.o 177 | .text.OWSearch_Next 178 | 0x00000000 0x30 ./src/onewire.o 179 | .text.OWSearch_Algorithm 180 | 0x00000000 0xa0 ./src/onewire.o 181 | .text.OW_CheckCRC8 182 | 0x00000000 0x2a ./src/onewire.o 183 | .text 0x00000000 0x0 ./src/startup.o 184 | .data 0x00000000 0x0 ./src/startup.o 185 | .bss 0x00000000 0x0 ./src/startup.o 186 | 187 | Memory Configuration 188 | 189 | Name Origin Length Attributes 190 | FlashMemory 0x08000000 0x00080000 xr 191 | SRAM 0x20000000 0x00010000 xrw 192 | SPIFlash 0xc0000000 0x00200000 xr 193 | *default* 0x00000000 0xffffffff 194 | 195 | Linker script and memory map 196 | 197 | LOAD ./src/test/heap_test.o 198 | LOAD ./src/test/onewire_test.o 199 | LOAD ./src/test/spi1_flash_test.o 200 | LOAD ./src/test/tft_test.o 201 | LOAD ./src/stm/flash.o 202 | LOAD ./src/stm/main.o 203 | LOAD ./src/stm/pin.o 204 | LOAD ./src/stm/spi1.o 205 | LOAD ./src/stm/system.o 206 | LOAD ./src/stm/tft.o 207 | LOAD ./src/cortex_m3.o 208 | LOAD ./src/helper.o 209 | LOAD ./src/kernel_exceptions.o 210 | LOAD ./src/kernel_exclusiveaccess.o 211 | LOAD ./src/kernel_heap.o 212 | LOAD ./src/kernel_scheduler.o 213 | LOAD ./src/onewire.o 214 | LOAD ./src/startup.o 215 | 0x08080000 __top_FlashMemory = 0x8080000 216 | 0x20010000 __top_SRAM = 0x20010000 217 | 0xc0200000 __top_SPIFlash = 0xc0200000 218 | 219 | .text 0x08000000 0x106c 220 | FILL mask 0xff 221 | 0x00000000 . = 0x0 222 | *(.interrupt_vectors) 223 | .interrupt_vectors 224 | 0x08000000 0x130 ./src/startup.o 225 | 0x08000000 InterruptVectors 226 | 0x08000130 . = ALIGN (0x4) 227 | *(.section_table) 228 | .section_table 229 | 0x08000130 0x14 ./src/startup.o 230 | 0x08000130 SectionTable 231 | 0x08000144 . = ALIGN (0x4) 232 | *(.after_vectors*) 233 | .after_vectors.DefaultExceptionHandlers 234 | 0x08000144 0x2 ./src/startup.o 235 | 0x08000144 HardFault_Handler 236 | 0x08000144 NMI_Handler 237 | 0x08000144 UsageFault_Handler 238 | 0x08000144 MemManage_Handler 239 | 0x08000144 BusFault_Handler 240 | 0x08000144 DebugMon_Handler 241 | .after_vectors.DefaultInterruptHandlers 242 | 0x08000146 0x2 ./src/startup.o 243 | 0x08000146 EXTI2_IRQHandler 244 | 0x08000146 TIM8_TRG_COM_IRQHandler 245 | 0x08000146 TIM8_CC_IRQHandler 246 | 0x08000146 TIM1_CC_IRQHandler 247 | 0x08000146 TIM6_IRQHandler 248 | 0x08000146 PVD_IRQHandler 249 | 0x08000146 SDIO_IRQHandler 250 | 0x08000146 EXTI3_IRQHandler 251 | 0x08000146 EXTI0_IRQHandler 252 | 0x08000146 I2C2_EV_IRQHandler 253 | 0x08000146 ADC1_2_IRQHandler 254 | 0x08000146 SPI1_IRQHandler 255 | 0x08000146 TAMPER_IRQHandler 256 | 0x08000146 TIM8_UP_IRQHandler 257 | 0x08000146 DMA2_Channel2_IRQHandler 258 | 0x08000146 DMA1_Channel4_IRQHandler 259 | 0x08000146 USART3_IRQHandler 260 | 0x08000146 RTC_IRQHandler 261 | 0x08000146 DMA1_Channel7_IRQHandler 262 | 0x08000146 CAN1_RX1_IRQHandler 263 | 0x08000146 UART5_IRQHandler 264 | 0x08000146 ADC3_IRQHandler 265 | 0x08000146 TIM4_IRQHandler 266 | 0x08000146 DMA2_Channel1_IRQHandler 267 | 0x08000146 I2C1_EV_IRQHandler 268 | 0x08000146 DMA1_Channel6_IRQHandler 269 | 0x08000146 UART4_IRQHandler 270 | 0x08000146 TIM3_IRQHandler 271 | 0x08000146 RCC_IRQHandler 272 | 0x08000146 TIM1_TRG_COM_IRQHandler 273 | 0x08000146 DMA1_Channel1_IRQHandler 274 | 0x08000146 EXTI15_10_IRQHandler 275 | 0x08000146 TIM7_IRQHandler 276 | 0x08000146 TIM5_IRQHandler 277 | 0x08000146 EXTI9_5_IRQHandler 278 | 0x08000146 SPI2_IRQHandler 279 | 0x08000146 DMA1_Channel5_IRQHandler 280 | 0x08000146 EXTI4_IRQHandler 281 | 0x08000146 USB_LP_CAN1_RX0_IRQHandler 282 | 0x08000146 USB_HP_CAN1_TX_IRQHandler 283 | 0x08000146 DMA1_Channel3_IRQHandler 284 | 0x08000146 FSMC_IRQHandler 285 | 0x08000146 TIM1_UP_IRQHandler 286 | 0x08000146 WWDG_IRQHandler 287 | 0x08000146 TIM1_BRK_IRQHandler 288 | 0x08000146 EXTI1_IRQHandler 289 | 0x08000146 RTCAlarm_IRQHandler 290 | 0x08000146 DMA2_Channel4_5_IRQHandler 291 | 0x08000146 USART2_IRQHandler 292 | 0x08000146 I2C2_ER_IRQHandler 293 | 0x08000146 DMA1_Channel2_IRQHandler 294 | 0x08000146 TIM8_BRK_IRQHandler 295 | 0x08000146 CAN1_SCE_IRQHandler 296 | 0x08000146 FLASH_IRQHandler 297 | 0x08000146 USART1_IRQHandler 298 | 0x08000146 SPI3_IRQHandler 299 | 0x08000146 I2C1_ER_IRQHandler 300 | 0x08000146 USBWakeUp_IRQHandler 301 | 0x08000146 DMA2_Channel3_IRQHandler 302 | .after_vectors.InitDataSection 303 | 0x08000148 0xe ./src/startup.o 304 | 0x08000150 InitDataSection 305 | .after_vectors.InitBssSection 306 | 0x08000156 0xa ./src/startup.o 307 | 0x0800015a InitBssSection 308 | .after_vectors.Reset_Handler 309 | 0x08000160 0x18 ./src/startup.o 310 | 0x08000160 Reset_Handler 311 | *(.text*) 312 | .text 0x08000178 0x2e0 ./src/test/tft_test.o 313 | 0x0800017c TaskTFTPerformance 314 | 0x0800018c TaskTFT 315 | 0x08000428 tft_test 316 | .text.FLASH_Init 317 | 0x08000458 0x18 ./src/stm/flash.o 318 | 0x08000458 FLASH_Init 319 | .text.FLASH_ReadBytes 320 | 0x08000470 0xa4 ./src/stm/flash.o 321 | 0x08000470 FLASH_ReadBytes 322 | .text.main 0x08000514 0x2c ./src/stm/main.o 323 | 0x08000514 main 324 | .text.PIN_Configure 325 | 0x08000540 0x20 ./src/stm/pin.o 326 | 0x08000540 PIN_Configure 327 | .text.SPI1_GetExclusiveAccess 328 | 0x08000560 0x3c ./src/stm/spi1.o 329 | 0x08000560 SPI1_GetExclusiveAccess 330 | .text.SPI1_ClearExclusiveAccess 331 | 0x0800059c 0x18 ./src/stm/spi1.o 332 | 0x0800059c SPI1_ClearExclusiveAccess 333 | .text.SPI1_Init 334 | 0x080005b4 0x40 ./src/stm/spi1.o 335 | 0x080005b4 SPI1_Init 336 | .text.SPI1_Transfer 337 | 0x080005f4 0x1c ./src/stm/spi1.o 338 | 0x080005f4 SPI1_Transfer 339 | .text.SystemInitClock 340 | 0x08000610 0x40 ./src/stm/system.o 341 | 0x08000610 SystemInitClock 342 | .text.SystemGetClock 343 | 0x08000650 0x48 ./src/stm/system.o 344 | 0x08000650 SystemGetClock 345 | .text.SystemEnablePeripheral 346 | 0x08000698 0x10 ./src/stm/system.o 347 | 0x08000698 SystemEnablePeripheral 348 | .text.TFT_Init 349 | 0x080006a8 0x180 ./src/stm/tft.o 350 | 0x080006a8 TFT_Init 351 | .text.TFT_ReadWriteFunctions 352 | 0x08000828 0x74 ./src/stm/tft.o 353 | 0x08000828 TFT_WriteMultipleRegisters 354 | 0x08000840 TFT_SetPixel 355 | 0x0800085e TFT_PrepareWindow 356 | .text.TFT_SetArea 357 | 0x0800089c 0x34 ./src/stm/tft.o 358 | 0x0800089c TFT_SetArea 359 | .text.TFT_SetLine 360 | 0x080008d0 0xb6 ./src/stm/tft.o 361 | 0x080008d0 TFT_SetLine 362 | *fill* 0x08000986 0x2 363 | .text.TFT_SetChar 364 | 0x08000988 0x50 ./src/stm/tft.o 365 | 0x08000988 TFT_SetChar 366 | .text.TFT_SelectFont 367 | 0x080009d8 0x48 ./src/stm/tft.o 368 | 0x080009d8 TFT_SelectFont 369 | .text.TFT_PrintString 370 | 0x08000a20 0x9c ./src/stm/tft.o 371 | 0x08000a20 TFT_PrintString 372 | .text.NVIC_EXCControlStatusBits 373 | 0x08000abc 0x40 ./src/cortex_m3.o 374 | 0x08000abc NVIC_EXCSetPendingNMI 375 | 0x08000ac2 NVIC_EXCClearPendingSysTick 376 | 0x08000ac8 NVIC_EXCSetPendingSysTick 377 | 0x08000ace NVIC_EXCClearPendingPendSV 378 | 0x08000ad4 NVIC_EXCSetPendingPendSV 379 | 0x08000ade NVIC_EXCIsPendingNMI 380 | 0x08000ae4 NVIC_EXCIsPendingSysTick 381 | 0x08000aea NVIC_EXCIsPendingPendSV 382 | .text.NVIC_EXCPriority 383 | 0x08000afc 0x14 ./src/cortex_m3.o 384 | 0x08000afc NVIC_EXCSetPriority 385 | 0x08000b04 NVIC_EXCGetPriority 386 | .text.NVIC_ControlFunctions 387 | 0x08000b10 0x28 ./src/cortex_m3.o 388 | 0x08000b10 NVIC_SetPriorityGrouping 389 | 0x08000b1c NVIC_SystemReset 390 | .text.NumberToBitInWord 391 | 0x08000b38 0x10 ./src/helper.o 392 | 0x08000b38 NumberTo4BitsInWord 393 | 0x08000b3a NumberTo2BitsInWord 394 | 0x08000b3c NumberToBitInWord 395 | .text.SVC_Handler 396 | 0x08000b48 0xd4 ./src/kernel_exceptions.o 397 | 0x08000b48 SVC_Handler 398 | .text.SysTick_Handler 399 | 0x08000c1c 0x5c ./src/kernel_exceptions.o 400 | 0x08000c1c SysTick_Handler 401 | .text.PendSV_Handler 402 | 0x08000c78 0x34 ./src/kernel_exceptions.o 403 | 0x08000c78 PendSV_Handler 404 | .text.KERNEL_GetExclusiveAccess 405 | 0x08000cac 0x16 ./src/kernel_exclusiveaccess.o 406 | 0x08000cac KERNEL_GetExclusiveAccess 407 | .text.KERNEL_ClearExclusiveAccess 408 | 0x08000cc2 0x6 ./src/kernel_exclusiveaccess.o 409 | 0x08000cc2 KERNEL_ClearExclusiveAccess 410 | .text.HeapManagement 411 | 0x08000cc8 0xa0 ./src/kernel_heap.o 412 | 0x08000cc8 KERNEL_InitHeap 413 | 0x08000cda KERNEL_Alloc 414 | 0x08000d18 KERNEL_Free 415 | .text.KERNEL_Init 416 | 0x08000d68 0x30 ./src/kernel_scheduler.o 417 | 0x08000d68 KERNEL_Init 418 | .text.KERNEL_AddTask 419 | 0x08000d98 0x60 ./src/kernel_scheduler.o 420 | 0x08000d98 KERNEL_AddTask 421 | .text.KERNEL_AddTaskToReadyList 422 | 0x08000df8 0x20 ./src/kernel_scheduler.o 423 | 0x08000df8 KERNEL_AddTaskToReadyList 424 | .text.KERNEL_RemoveTaskFromReadyList 425 | 0x08000e18 0x30 ./src/kernel_scheduler.o 426 | 0x08000e18 KERNEL_RemoveTaskFromReadyList 427 | .text.KERNEL_AddTaskToDelayedList 428 | 0x08000e48 0x20 ./src/kernel_scheduler.o 429 | 0x08000e48 KERNEL_AddTaskToDelayedList 430 | .text.KERNEL_Start 431 | 0x08000e68 0x4c ./src/kernel_scheduler.o 432 | 0x08000e68 KERNEL_Start 433 | .text.KERNEL_TaskIdle 434 | 0x08000eb4 0x4 ./src/kernel_scheduler.o 435 | 0x08000eb4 KERNEL_TaskIdle 436 | .text.KERNEL_KillTask 437 | 0x08000eb8 0x8 ./src/kernel_scheduler.o 438 | 0x08000eb8 KERNEL_KillTask 439 | .text.TIM2_IRQHandler 440 | 0x08000ec0 0x10c ./src/onewire.o 441 | 0x08000ec0 TIM2_IRQHandler 442 | *(.rodata .rodata.*) 443 | .rodata 0x08000fcc 0x20 ./src/test/tft_test.o 444 | 0x08000fcc TaskDescriptor_TaskTFT 445 | 0x08000fdc TaskDescriptor_TaskTFTPerformance 446 | .rodata.str1.4 447 | 0x08000fec 0x70 ./src/test/tft_test.o 448 | .rodata.TaskDescriptors 449 | 0x0800105c 0x10 ./src/kernel_scheduler.o 450 | 0x0800105c KERNEL_TaskIdleDescriptor 451 | 0x0800106c . = ALIGN (0x4) 452 | 453 | .glue_7 0x0800106c 0x0 454 | .glue_7 0x00000000 0x0 linker stubs 455 | 456 | .glue_7t 0x0800106c 0x0 457 | .glue_7t 0x00000000 0x0 linker stubs 458 | 459 | .vfp11_veneer 0x0800106c 0x0 460 | .vfp11_veneer 0x00000000 0x0 linker stubs 461 | 462 | .v4_bx 0x0800106c 0x0 463 | .v4_bx 0x00000000 0x0 linker stubs 464 | 465 | .iplt 0x0800106c 0x0 466 | .iplt 0x00000000 0x0 ./src/test/heap_test.o 467 | 468 | .rel.dyn 0x0800106c 0x0 469 | .rel.iplt 0x00000000 0x0 ./src/test/heap_test.o 470 | 471 | .ext 0xc0000000 0x2724 472 | FILL mask 0xff 473 | *(.ext*) 474 | .ext 0xc0000000 0x2724 ./src/test/tft_test.o 475 | 0xc0002724 . = ALIGN (0x4) 476 | 0xc0000000 __ext_StartAddress = ADDR (.ext) 477 | 478 | .data 0x20000000 0x0 load address 0x0800106c 479 | FILL mask 0xff 480 | *(.data.AHB*) 481 | 0x20000000 . = ALIGN (0x4) 482 | *(.data*) 483 | 0x20000000 . = ALIGN (0x4) 484 | 0x00000000 __data_Size = SIZEOF (.data) 485 | 0x0800106c __data_LoadAddress = LOADADDR (.data) 486 | 0x20000000 __data_StartAddress = ADDR (.data) 487 | 0x20000000 __data_EndAddress = (ADDR (.data) + SIZEOF (.data)) 488 | 489 | .igot.plt 0x20000000 0x0 load address 0x0800106c 490 | .igot.plt 0x00000000 0x0 ./src/test/heap_test.o 491 | 492 | .bss 0x20000000 0xaf4 load address 0x0800106c 493 | *(.bss.bitband*) 494 | .bss.bitband.OW_TransferBuffers 495 | 0x20000000 0x20 ./src/onewire.o 496 | 0x20000000 OW_TransferWriteBuffer 497 | 0x20000000 OW_TransferBuffers 498 | 0x20000010 OW_TransferReadBuffer 499 | .bss.bitband.OWSearch_ROM 500 | 0x20000020 0x8 ./src/onewire.o 501 | 0x20000020 OWSearch_ROM 502 | *(.bss.AHB*) 503 | 0x20000028 . = ALIGN (0x4) 504 | *(.bss*) 505 | .bss.SPI1_Data 506 | 0x20000028 0x4 ./src/stm/spi1.o 507 | 0x20000028 SPI1_ExclusiveAccessSPI 508 | 0x20000028 SPI1_Data 509 | 0x20000028 SPI1_ExclusiveAccess 510 | 0x20000029 SPI1_ExclusiveAccessDMA 511 | .bss.SystemClock 512 | 0x2000002c 0x4 ./src/stm/system.o 513 | 0x2000002c SystemClock 514 | .bss.TFT_Data 0x20000030 0x1ec ./src/stm/tft.o 515 | 0x20000030 TFT_Data 516 | 0x20000030 TFT_CachedFont 517 | 0x20000034 TFT_Color 518 | 0x20000036 TFT_CachedChar 519 | 0x20000037 TFT_FontInfo 520 | 0x20000037 TFT_FontWidth 521 | 0x20000038 TFT_CharHeight 522 | 0x20000038 TFT_FontHeight 523 | 0x20000039 TFT_FontFirstChar 524 | 0x2000003a TFT_FontCharCount 525 | 0x2000003b TFT_CharWidth 526 | 0x2000003c TFT_CacheWidth 527 | 0x2000009c TFT_CacheChar 528 | .bss.KERNEL_Time 529 | 0x2000021c 0x8 ./src/kernel_exceptions.o 530 | 0x2000021c KERNEL_Time 531 | .bss.KERNEL_Heap 532 | 0x20000224 0x800 ./src/kernel_heap.o 533 | 0x20000224 KERNEL_Heap 534 | .bss.KERNEL_HeapEmptyList 535 | 0x20000a24 0x4 ./src/kernel_heap.o 536 | 0x20000a24 KERNEL_HeapEmptyList 537 | .bss.KERNEL_TaskTable 538 | 0x20000a28 0xa0 ./src/kernel_scheduler.o 539 | 0x20000a28 KERNEL_TaskTable 540 | .bss.KERNEL_TaskReadyLists 541 | 0x20000ac8 0x10 ./src/kernel_scheduler.o 542 | 0x20000ac8 KERNEL_TaskReadyLists 543 | .bss.KERNEL_TaskDelayedList 544 | 0x20000ad8 0x8 ./src/kernel_scheduler.o 545 | 0x20000ad8 KERNEL_TaskDelayedList 546 | 0x20000adc KERNEL_TaskDelayedListOverflow 547 | .bss.KERNEL_TaskRunning 548 | 0x20000ae0 0x4 ./src/kernel_scheduler.o 549 | 0x20000ae0 KERNEL_TaskRunning 550 | .bss.OW_TransferData 551 | 0x20000ae4 0x10 ./src/onewire.o 552 | 0x20000ae4 OW_TransferData 553 | 0x20000ae4 OW_TransferInternalCount 554 | 0x20000ae6 OW_TransferInternalStateAndLock 555 | 0x20000ae7 OW_TransferResetAndStatus 556 | 0x20000ae8 OW_TransferWriteNBits 557 | 0x20000aea OW_TransferReadNBits 558 | 0x20000aec OW_TransferPin 559 | 0x20000af0 OW_TransferCallbackFunction 560 | 0x20000af4 . = ALIGN (0x4) 561 | 0x00000af4 __bss_Size = SIZEOF (.bss) 562 | 0x20000000 __bss_StartAddress = ADDR (.bss) 563 | 0x20000af4 __bss_EndAddress = (ADDR (.bss) + SIZEOF (.bss)) 564 | 565 | .noinit 0x20000af4 0x0 load address 0x0800106c 566 | *(.noinit.bitband*) 567 | *(.noinit.AHB*) 568 | 0x20000af4 . = ALIGN (0x4) 569 | *(.noinit*) 570 | 0x20000af4 . = ALIGN (0x4) 571 | OUTPUT(CM3_Assembly.axf elf32-littlearm) 572 | 573 | .debug_info 0x00000000 0x11dd 574 | .debug_info 0x00000000 0xa83 ./src/test/tft_test.o 575 | .debug_info 0x00000a83 0x84 ./src/stm/flash.o 576 | .debug_info 0x00000b07 0x87 ./src/stm/main.o 577 | .debug_info 0x00000b8e 0x86 ./src/stm/pin.o 578 | .debug_info 0x00000c14 0x83 ./src/stm/spi1.o 579 | .debug_info 0x00000c97 0x85 ./src/stm/system.o 580 | .debug_info 0x00000d1c 0x82 ./src/stm/tft.o 581 | .debug_info 0x00000d9e 0x84 ./src/cortex_m3.o 582 | .debug_info 0x00000e22 0x85 ./src/helper.o 583 | .debug_info 0x00000ea7 0x8c ./src/kernel_exceptions.o 584 | .debug_info 0x00000f33 0x91 ./src/kernel_exclusiveaccess.o 585 | .debug_info 0x00000fc4 0x8a ./src/kernel_heap.o 586 | .debug_info 0x0000104e 0x8b ./src/kernel_scheduler.o 587 | .debug_info 0x000010d9 0x82 ./src/onewire.o 588 | .debug_info 0x0000115b 0x82 ./src/startup.o 589 | 590 | .debug_abbrev 0x00000000 0x2c3 591 | .debug_abbrev 0x00000000 0x1bf ./src/test/tft_test.o 592 | .debug_abbrev 0x000001bf 0x12 ./src/stm/flash.o 593 | .debug_abbrev 0x000001d1 0x14 ./src/stm/main.o 594 | .debug_abbrev 0x000001e5 0x14 ./src/stm/pin.o 595 | .debug_abbrev 0x000001f9 0x12 ./src/stm/spi1.o 596 | .debug_abbrev 0x0000020b 0x12 ./src/stm/system.o 597 | .debug_abbrev 0x0000021d 0x12 ./src/stm/tft.o 598 | .debug_abbrev 0x0000022f 0x12 ./src/cortex_m3.o 599 | .debug_abbrev 0x00000241 0x14 ./src/helper.o 600 | .debug_abbrev 0x00000255 0x12 ./src/kernel_exceptions.o 601 | .debug_abbrev 0x00000267 0x12 ./src/kernel_exclusiveaccess.o 602 | .debug_abbrev 0x00000279 0x14 ./src/kernel_heap.o 603 | .debug_abbrev 0x0000028d 0x12 ./src/kernel_scheduler.o 604 | .debug_abbrev 0x0000029f 0x12 ./src/onewire.o 605 | .debug_abbrev 0x000002b1 0x12 ./src/startup.o 606 | 607 | .debug_loc 0x00000000 0x8b 608 | .debug_loc 0x00000000 0x8b ./src/test/tft_test.o 609 | 610 | .debug_aranges 0x00000000 0x338 611 | .debug_aranges 612 | 0x00000000 0x20 ./src/test/tft_test.o 613 | .debug_aranges 614 | 0x00000020 0x30 ./src/stm/flash.o 615 | .debug_aranges 616 | 0x00000050 0x20 ./src/stm/main.o 617 | .debug_aranges 618 | 0x00000070 0x20 ./src/stm/pin.o 619 | .debug_aranges 620 | 0x00000090 0x38 ./src/stm/spi1.o 621 | .debug_aranges 622 | 0x000000c8 0x48 ./src/stm/system.o 623 | .debug_aranges 624 | 0x00000110 0x50 ./src/stm/tft.o 625 | .debug_aranges 626 | 0x00000160 0x48 ./src/cortex_m3.o 627 | .debug_aranges 628 | 0x000001a8 0x20 ./src/helper.o 629 | .debug_aranges 630 | 0x000001c8 0x30 ./src/kernel_exceptions.o 631 | .debug_aranges 632 | 0x000001f8 0x28 ./src/kernel_exclusiveaccess.o 633 | .debug_aranges 634 | 0x00000220 0x20 ./src/kernel_heap.o 635 | .debug_aranges 636 | 0x00000240 0x60 ./src/kernel_scheduler.o 637 | .debug_aranges 638 | 0x000002a0 0x58 ./src/onewire.o 639 | .debug_aranges 640 | 0x000002f8 0x40 ./src/startup.o 641 | 642 | .debug_macro 0x00000000 0x10f 643 | .debug_macro 0x00000000 0xb9 ./src/test/tft_test.o 644 | .debug_macro 0x000000b9 0x10 ./src/test/tft_test.o 645 | .debug_macro 0x000000c9 0x46 ./src/test/tft_test.o 646 | 647 | .debug_line 0x00000000 0xfcb 648 | .debug_line 0x00000000 0x372 ./src/test/tft_test.o 649 | .debug_line 0x00000372 0xd0 ./src/stm/flash.o 650 | .debug_line 0x00000442 0x4e ./src/stm/main.o 651 | .debug_line 0x00000490 0x4e ./src/stm/pin.o 652 | .debug_line 0x000004de 0xb9 ./src/stm/spi1.o 653 | .debug_line 0x00000597 0xdf ./src/stm/system.o 654 | .debug_line 0x00000676 0x23c ./src/stm/tft.o 655 | .debug_line 0x000008b2 0xf0 ./src/cortex_m3.o 656 | .debug_line 0x000009a2 0x44 ./src/helper.o 657 | .debug_line 0x000009e6 0xfe ./src/kernel_exceptions.o 658 | .debug_line 0x00000ae4 0x69 ./src/kernel_exclusiveaccess.o 659 | .debug_line 0x00000b4d 0x93 ./src/kernel_heap.o 660 | .debug_line 0x00000be0 0x16c ./src/kernel_scheduler.o 661 | .debug_line 0x00000d4c 0x1ec ./src/onewire.o 662 | .debug_line 0x00000f38 0x93 ./src/startup.o 663 | 664 | .debug_str 0x00000000 0x51a1 665 | .debug_str 0x00000000 0x51a1 ./src/test/tft_test.o 666 | 0x5330 (size before relaxing) 667 | 668 | .comment 0x00000000 0x70 669 | .comment 0x00000000 0x70 ./src/test/tft_test.o 670 | 0x71 (size before relaxing) 671 | 672 | .ARM.attributes 673 | 0x00000000 0x2f 674 | .ARM.attributes 675 | 0x00000000 0x33 ./src/test/tft_test.o 676 | .ARM.attributes 677 | 0x00000033 0x21 ./src/stm/flash.o 678 | .ARM.attributes 679 | 0x00000054 0x21 ./src/stm/main.o 680 | .ARM.attributes 681 | 0x00000075 0x21 ./src/stm/pin.o 682 | .ARM.attributes 683 | 0x00000096 0x21 ./src/stm/spi1.o 684 | .ARM.attributes 685 | 0x000000b7 0x21 ./src/stm/system.o 686 | .ARM.attributes 687 | 0x000000d8 0x21 ./src/stm/tft.o 688 | .ARM.attributes 689 | 0x000000f9 0x21 ./src/cortex_m3.o 690 | .ARM.attributes 691 | 0x0000011a 0x21 ./src/helper.o 692 | .ARM.attributes 693 | 0x0000013b 0x21 ./src/kernel_exceptions.o 694 | .ARM.attributes 695 | 0x0000015c 0x21 ./src/kernel_exclusiveaccess.o 696 | .ARM.attributes 697 | 0x0000017d 0x21 ./src/kernel_heap.o 698 | .ARM.attributes 699 | 0x0000019e 0x21 ./src/kernel_scheduler.o 700 | .ARM.attributes 701 | 0x000001bf 0x21 ./src/onewire.o 702 | .ARM.attributes 703 | 0x000001e0 0x21 ./src/startup.o 704 | 705 | .debug_frame 0x00000000 0x70 706 | .debug_frame 0x00000000 0x70 ./src/test/tft_test.o 707 | 708 | .debug_ranges 0x00000000 0x248 709 | .debug_ranges 0x00000000 0x28 ./src/stm/flash.o 710 | .debug_ranges 0x00000028 0x30 ./src/stm/spi1.o 711 | .debug_ranges 0x00000058 0x40 ./src/stm/system.o 712 | .debug_ranges 0x00000098 0x48 ./src/stm/tft.o 713 | .debug_ranges 0x000000e0 0x40 ./src/cortex_m3.o 714 | .debug_ranges 0x00000120 0x28 ./src/kernel_exceptions.o 715 | .debug_ranges 0x00000148 0x20 ./src/kernel_exclusiveaccess.o 716 | .debug_ranges 0x00000168 0x58 ./src/kernel_scheduler.o 717 | .debug_ranges 0x000001c0 0x50 ./src/onewire.o 718 | .debug_ranges 0x00000210 0x38 ./src/startup.o 719 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryConfiguration/MemoryConfiguration.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryConfiguration; 2 | import java.util.ArrayList; 3 | 4 | public class MemoryConfiguration 5 | { 6 | // Constants 7 | public static final long DEFAULT_TOTALSIZE = -1; 8 | 9 | // Attributes 10 | private long totalSize; 11 | private ArrayList spaces; 12 | 13 | // Attributes - protection 14 | private boolean isSetTotalSize = false; 15 | 16 | // Constructors 17 | public MemoryConfiguration (long totalSize, ArrayList spaces) { 18 | setTotalSize(totalSize); 19 | this.spaces = spaces; 20 | } 21 | 22 | public MemoryConfiguration () { 23 | this.totalSize = DEFAULT_TOTALSIZE; 24 | this.spaces = new ArrayList(); 25 | } 26 | 27 | // Getters 28 | public long getTotalSize () { 29 | return this.totalSize; 30 | } 31 | 32 | public int getNumberOfSpaces () { 33 | return this.spaces.size(); 34 | } 35 | 36 | public Space getSpace (int space) { 37 | return this.spaces.get(space); 38 | } 39 | 40 | // Setters 41 | public void setTotalSize (long totalSize) { 42 | if (!isSetTotalSize) { 43 | this.totalSize = totalSize; 44 | isSetTotalSize = true; 45 | } 46 | else 47 | System.err.println("The total size of the memory configuration can only be set once!"); 48 | } 49 | 50 | public void addSpace (Space space) { 51 | for (int i = 0; i < spaces.size(); i++) { 52 | if (spaces.get(i).getOrigin() > space.getOrigin()) { 53 | spaces.add(i, space); 54 | return; 55 | } 56 | } 57 | spaces.add(space); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryConfiguration/MemoryConfigurationLoader.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryConfiguration; 2 | import java.io.BufferedReader; 3 | import java.io.IOException; 4 | import java.util.regex.Matcher; 5 | import java.util.regex.Pattern; 6 | 7 | public class MemoryConfigurationLoader 8 | { 9 | // Basic patterns 10 | private static final String startConfiguration = "Memory Configuration"; 11 | private static final String endConfiguration = "Linker script and memory map"; 12 | private static final String defaultSpace = "*default*"; 13 | private static final String regexOfName = "(\\S+)"; 14 | private static final String regexOfOrigin = "(0x[a-fA-F0-9]{8})"; 15 | private static final String regexOfLength = "(0x[a-fA-F0-9]+)"; 16 | private static final String regexOfAttributes = "(x?)(r?)(w?)"; 17 | 18 | // Compiled patterns 19 | private static final Pattern patternOfSpace = Pattern.compile(regexOfName + "\\s+" + regexOfOrigin + "\\s+" + regexOfLength + "\\s*" + regexOfAttributes); 20 | 21 | // Helper function - Data 22 | private static long getOrigin (String origin) { 23 | if (origin == null) 24 | return Space.DEFAULT_ORIGIN; 25 | else 26 | return Long.parseLong(origin.substring(2, origin.length()), 16); 27 | } 28 | 29 | private static long getLength (String length) { 30 | if (length == null) 31 | return Space.DEFAULT_LENGTH; 32 | else 33 | return Long.parseLong(length.substring(2, length.length()), 16); 34 | } 35 | 36 | // Helper functions - Reader 37 | private static BufferedReader reader; 38 | private static String readerLine; 39 | 40 | private static String getNextLine () 41 | { 42 | // Read next line (skip blank lines) and store it AND return it 43 | try 44 | { 45 | while (readerLine != null) 46 | { 47 | readerLine = reader.readLine(); 48 | if (readerLine.length() != 0) 49 | return readerLine; 50 | } 51 | } 52 | catch (IOException e) 53 | { 54 | System.err.println("Error reading next line: " + e.getMessage()); 55 | } 56 | 57 | return readerLine; 58 | } 59 | 60 | // Helper functions - Loader 61 | private static boolean isDefaultSpace (Space space) 62 | { 63 | return ((space.getName().equals(defaultSpace)) && 64 | (space.getOrigin() == 0) && 65 | (space.getLength() > 0) && 66 | (!space.getAttributes().isErasable()) && 67 | (!space.getAttributes().isReadable()) && 68 | (!space.getAttributes().isWritable())); 69 | } 70 | 71 | private static MemoryConfiguration loadConfiguration () 72 | { 73 | MemoryConfiguration todoConfiguration = new MemoryConfiguration(); 74 | 75 | // Find the start of the memory configuration 76 | while (!readerLine.startsWith(startConfiguration)) 77 | getNextLine(); 78 | 79 | // Parse and store the spaces of the memory configuration 80 | while (!readerLine.startsWith(endConfiguration)) 81 | { 82 | Matcher matcher = patternOfSpace.matcher(readerLine); 83 | if (matcher.matches()) 84 | { 85 | // Create a new space with the name, origin, length and attributes found 86 | SpaceAttributes todoAttributes = new SpaceAttributes(); 87 | todoAttributes.setErasable(matcher.group(4).length() != 0); 88 | todoAttributes.setReadable(matcher.group(5).length() != 0); 89 | todoAttributes.setWritable(matcher.group(6).length() != 0); 90 | 91 | Space todoSpace = new Space(); 92 | todoSpace.setName(matcher.group(1)); 93 | todoSpace.setOrigin(getOrigin(matcher.group(2))); 94 | todoSpace.setLength(getLength(matcher.group(3))); 95 | todoSpace.setAttributes(todoAttributes); 96 | 97 | // Check for the space defining the addressable area 98 | if (isDefaultSpace(todoSpace)) 99 | todoConfiguration.setTotalSize(todoSpace.getLength()); 100 | else 101 | todoConfiguration.addSpace(todoSpace); 102 | } 103 | getNextLine(); 104 | } 105 | 106 | return todoConfiguration; 107 | } 108 | 109 | // Wrapper - Loader 110 | public static MemoryConfiguration load (BufferedReader bufferedReader) 111 | { 112 | // Wrap to other loaders, using one buffered reader 113 | reader = bufferedReader; 114 | readerLine = ""; 115 | return loadConfiguration(); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryConfiguration/Space.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryConfiguration; 2 | 3 | public class Space 4 | { 5 | // Constants 6 | public static final String DEFAULT_NAME = ""; 7 | public static final long DEFAULT_ORIGIN = -1; 8 | public static final long DEFAULT_LENGTH = -1; 9 | public static final SpaceAttributes DEFAULT_ATTRIBUTES = null; 10 | 11 | // Attributes 12 | private String name; 13 | private long origin; 14 | private long length; 15 | private SpaceAttributes attributes; 16 | 17 | // Attributes - protection 18 | private boolean isSetName = false; 19 | private boolean isSetOrigin = false; 20 | private boolean isSetLength = false; 21 | private boolean isSetAttributes = false; 22 | 23 | // Constructors 24 | public Space (String name, long origin, long length, SpaceAttributes attributes) { 25 | setName(name); 26 | setOrigin(origin); 27 | setLength(length); 28 | setAttributes(attributes); 29 | } 30 | 31 | public Space () { 32 | this.name = DEFAULT_NAME; 33 | this.origin = DEFAULT_ORIGIN; 34 | this.length = DEFAULT_LENGTH; 35 | this.attributes = DEFAULT_ATTRIBUTES; 36 | } 37 | 38 | // Getters 39 | public String getName () { 40 | return this.name; 41 | } 42 | 43 | public long getOrigin () { 44 | return this.origin; 45 | } 46 | 47 | public long getLength() { 48 | return this.length; 49 | } 50 | 51 | public SpaceAttributes getAttributes () { 52 | return this.attributes; 53 | } 54 | 55 | // Setters 56 | public void setName (String name) { 57 | if (!isSetName) { 58 | this.name = name; 59 | isSetName = true; 60 | } 61 | else 62 | System.err.println("The name of the space can only be set once!"); 63 | } 64 | 65 | public void setOrigin (long origin) { 66 | if (!isSetOrigin) { 67 | this.origin = origin; 68 | isSetOrigin = true; 69 | } 70 | else 71 | System.err.println("The origin of the space can only be set once!"); 72 | } 73 | 74 | public void setLength (long length) { 75 | if (!isSetLength) { 76 | this.length = length; 77 | isSetLength = true; 78 | } 79 | else 80 | System.err.println("The length of the space can only be set once!"); 81 | } 82 | 83 | public void setAttributes (SpaceAttributes attributes) { 84 | if (!isSetAttributes) { 85 | this.attributes = attributes; 86 | isSetAttributes = true; 87 | } 88 | else 89 | System.err.println("The attributes of the space can only be set once!"); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryConfiguration/SpaceAttributes.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryConfiguration; 2 | 3 | public class SpaceAttributes 4 | { 5 | // Constants 6 | public static final boolean DEFAULT_ERASABLE = false; 7 | public static final boolean DEFAULT_READABLE = false; 8 | public static final boolean DEFAULT_WRITABLE = false; 9 | 10 | // Attributes 11 | private boolean erasable; 12 | private boolean readable; 13 | private boolean writable; 14 | 15 | // Attributes - protection 16 | private boolean isSetErasable = false; 17 | private boolean isSetReadable = false; 18 | private boolean isSetWritable = false; 19 | 20 | // Constructors 21 | public SpaceAttributes (boolean erasable, boolean readable, boolean writable) { 22 | setErasable(erasable); 23 | setReadable(readable); 24 | setWritable(writable); 25 | } 26 | 27 | public SpaceAttributes () { 28 | this.erasable = DEFAULT_ERASABLE; 29 | this.readable = DEFAULT_READABLE; 30 | this.writable = DEFAULT_WRITABLE; 31 | } 32 | 33 | // Getters 34 | public boolean isErasable () { 35 | return this.erasable; 36 | } 37 | 38 | public boolean isReadable () { 39 | return this.readable; 40 | } 41 | 42 | public boolean isWritable () { 43 | return this.writable; 44 | } 45 | 46 | // Setters 47 | public void setErasable (boolean erasable) { 48 | if (!isSetErasable) { 49 | this.erasable = erasable; 50 | isSetErasable = true; 51 | } 52 | else 53 | System.err.println("The attribute erasable of the space attributes can only be set once!"); 54 | } 55 | 56 | public void setReadable (boolean readable) { 57 | if (!isSetReadable) { 58 | this.readable = readable; 59 | isSetReadable = true; 60 | } 61 | else 62 | System.err.println("The attribute readable of the space attributes can only be set once!"); 63 | } 64 | 65 | public void setWritable (boolean writable) { 66 | if (!isSetWritable) { 67 | this.writable = writable; 68 | isSetWritable = true; 69 | } 70 | else 71 | System.err.println("The attribute writable of the space attributes can only be set once!"); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryConfigurationAndContentsComponent.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Component; 5 | import java.awt.Dimension; 6 | import java.awt.event.ItemEvent; 7 | import java.awt.event.ItemListener; 8 | import java.awt.event.MouseAdapter; 9 | import java.awt.event.MouseEvent; 10 | import java.util.ArrayList; 11 | 12 | import javax.swing.BorderFactory; 13 | import javax.swing.DefaultListCellRenderer; 14 | import javax.swing.DefaultListModel; 15 | import javax.swing.JComboBox; 16 | import javax.swing.JLabel; 17 | import javax.swing.JList; 18 | import javax.swing.JPanel; 19 | import javax.swing.JScrollPane; 20 | import javax.swing.JTable; 21 | import javax.swing.ListSelectionModel; 22 | import javax.swing.border.Border; 23 | import javax.swing.border.EtchedBorder; 24 | import javax.swing.table.AbstractTableModel; 25 | 26 | import MemoryViewer.MemoryContents.DataContent; 27 | import MemoryViewer.MemoryContents.FillContent; 28 | import MemoryViewer.MemoryContents.IdentifierContent; 29 | import MemoryViewer.MemoryContents.MemoryContents; 30 | import MemoryViewer.MemoryConfiguration.MemoryConfiguration; 31 | import MemoryViewer.MemoryConfiguration.Space; 32 | 33 | public class MemoryConfigurationAndContentsComponent extends JPanel implements MemoryInfoUpdateListener, ItemListener, MemoryConfigurationSelectionListener 34 | { 35 | private static final long serialVersionUID = 1L; 36 | 37 | // Constants 38 | private static final String SELECTION_IDENTIFIER = "Identifier"; 39 | private static final String SELECTION_DATA = "Data"; 40 | private static final String SELECTION_FILL = "Fill"; 41 | 42 | // Listeners 43 | private ArrayList memoryDetailsListeners; 44 | 45 | // Memory info 46 | private MemoryConfiguration memoryConfiguration; 47 | private boolean[] memoryConfigurationEnables; 48 | private MemoryContents memoryContents; 49 | 50 | // Configuration view 51 | private MemoryConfigurationTableModel memoryConfigurationTableModel; 52 | private JTable memoryConfigurationTable; 53 | private JPanel memoryConfigurationPanel; 54 | private Border memoryConfigurationBorder; 55 | 56 | // Contents view 57 | private JComboBox memoryContentsSelectionBox; 58 | private MemoryContentsList memoryContentsList; 59 | private JPanel memoryContentsPanel; 60 | private Border memoryContentsBorder; 61 | 62 | // Constructor 63 | public MemoryConfigurationAndContentsComponent () { 64 | 65 | memoryDetailsListeners = new ArrayList(); 66 | memoryConfiguration = null; 67 | memoryConfigurationEnables = new boolean[0]; 68 | memoryContents = null; 69 | 70 | // Create contents 71 | memoryConfigurationTableModel = new MemoryConfigurationTableModel(); 72 | memoryConfigurationTable = new JTable(memoryConfigurationTableModel); 73 | memoryConfigurationPanel = new JPanel(new BorderLayout()); 74 | memoryConfigurationBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Memory Configuration"); 75 | memoryContentsSelectionBox = new JComboBox(); 76 | memoryContentsSelectionBox.addItem(SELECTION_IDENTIFIER); 77 | memoryContentsSelectionBox.addItem(SELECTION_DATA); 78 | memoryContentsSelectionBox.addItem(SELECTION_FILL); 79 | memoryContentsList = new MemoryContentsList(); 80 | memoryContentsPanel = new JPanel(new BorderLayout()); 81 | memoryContentsBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Memory Contents"); 82 | 83 | // Add listeners 84 | memoryConfigurationTable.addMouseListener(new MemoryConfigurationMouseListener()); 85 | memoryConfigurationTableModel.addMemoryConfigurationSelectionListener(this); 86 | memoryContentsSelectionBox.addItemListener(this); 87 | memoryContentsList.addMouseListener(new MemoryContentsMouseListener()); 88 | 89 | // Bind contents 90 | setLayout(new BorderLayout()); 91 | add(memoryConfigurationPanel, BorderLayout.NORTH); 92 | memoryConfigurationPanel.add(memoryConfigurationTable.getTableHeader(), BorderLayout.NORTH); 93 | memoryConfigurationPanel.add(memoryConfigurationTable, BorderLayout.CENTER); 94 | memoryConfigurationPanel.setBorder(memoryConfigurationBorder); 95 | add(memoryContentsPanel, BorderLayout.CENTER); 96 | memoryContentsPanel.add(memoryContentsSelectionBox, BorderLayout.NORTH); 97 | memoryContentsPanel.add(new JScrollPane(memoryContentsList), BorderLayout.CENTER); 98 | memoryContentsPanel.setBorder(memoryContentsBorder); 99 | 100 | // Set preferred sizes 101 | memoryContentsPanel.setPreferredSize(new Dimension(300, 100)); 102 | } 103 | 104 | public void addMemoryDetailsListener (MemoryDetailsListener memoryDetailsListener) { 105 | memoryDetailsListeners.add(memoryDetailsListener); 106 | } 107 | 108 | private void notifyMemoryDetailsListeners (Object object) { 109 | for (int i = 0; i < memoryDetailsListeners.size(); i++) 110 | memoryDetailsListeners.get(i).showDetails(object); 111 | } 112 | 113 | // MemoryConfigurationMouseListener 114 | class MemoryConfigurationMouseListener extends MouseAdapter { 115 | public void mouseClicked(MouseEvent e) { 116 | int selectedSpace = memoryConfigurationTable.getSelectedRow(); 117 | if (memoryConfiguration != null && selectedSpace < memoryConfiguration.getNumberOfSpaces()) 118 | notifyMemoryDetailsListeners(memoryConfiguration.getSpace(selectedSpace)); 119 | } 120 | } 121 | 122 | // MemoryContentsMouseListener 123 | class MemoryContentsMouseListener extends MouseAdapter { 124 | public void mouseClicked(MouseEvent e) { 125 | Object selectedObject = memoryContentsList.getSelectedValue(); 126 | if (selectedObject != null) 127 | notifyMemoryDetailsListeners(selectedObject); 128 | } 129 | } 130 | 131 | // MemoryConfigurationSelectionListener 132 | public void selectionChanged (boolean[] memoryConfigurationEnables) { 133 | this.memoryConfigurationEnables = memoryConfigurationEnables; 134 | updateContents(); 135 | } 136 | 137 | // ItemListener 138 | public void itemStateChanged(ItemEvent e) { 139 | updateContents(); 140 | } 141 | 142 | // MemoryInfoUpdateListener 143 | public void update (MemoryInfoFactory memoryInfoFactory) { 144 | this.memoryConfiguration = memoryInfoFactory.getMemoryConfiguration(); 145 | this.memoryContents = memoryInfoFactory.getMemoryContents(); 146 | 147 | updateConfiguration(); 148 | updateContents(); 149 | } 150 | 151 | // Updaters 152 | private void updateConfiguration () { 153 | memoryConfigurationTableModel.setMemoryConfiguration(memoryConfiguration); 154 | } 155 | 156 | private void updateContents () { 157 | memoryContentsList.setMemoryContents(filterMemoryContents()); 158 | } 159 | 160 | // Filter 161 | private MemoryContents filterMemoryContents () { 162 | 163 | if (memoryContents == null) 164 | return null; 165 | 166 | MemoryContents filteredMemoryContents = new MemoryContents(); 167 | 168 | if (memoryContentsSelectionBox.getSelectedItem().equals(SELECTION_IDENTIFIER)) { 169 | // Add all identifiers in selected range 170 | for (int i = 0; i < memoryContents.getNumberOfIdentifierContents(); i++) { 171 | if (isInSelectedRange(memoryContents.getIdentifierContent(i).getAddress())) { 172 | filteredMemoryContents.addIdentifierContent(memoryContents.getIdentifierContent(i)); 173 | } 174 | } 175 | } else if (memoryContentsSelectionBox.getSelectedItem().equals(SELECTION_DATA)) { 176 | // Add all datas in selected range 177 | for (int i = 0; i < memoryContents.getNumberOfDataContents(); i++) { 178 | if (isInSelectedRange(memoryContents.getDataContent(i).getAddress())) { 179 | filteredMemoryContents.addDataContent(memoryContents.getDataContent(i)); 180 | } 181 | } 182 | } else if (memoryContentsSelectionBox.getSelectedItem().equals(SELECTION_FILL)) { 183 | // Add all fills in selected range 184 | for (int i = 0; i < memoryContents.getNumberOfFillContents(); i++) { 185 | if (isInSelectedRange(memoryContents.getFillContent(i).getAddress())) { 186 | filteredMemoryContents.addFillContent(memoryContents.getFillContent(i)); 187 | } 188 | } 189 | } 190 | 191 | return filteredMemoryContents; 192 | } 193 | 194 | private boolean isInSelectedRange (long address) { 195 | for (int i = 0; i < memoryConfigurationEnables.length; i++) { 196 | if (memoryConfigurationEnables[i]) { 197 | Space space = memoryConfiguration.getSpace(i); 198 | if ((space.getOrigin() <= address) && (space.getOrigin() + space.getLength()) > address) 199 | return true; 200 | } 201 | } 202 | return false; 203 | } 204 | } 205 | 206 | class MemoryConfigurationTableModel extends AbstractTableModel 207 | { 208 | private static final long serialVersionUID = 1L; 209 | 210 | // Attributes 211 | private ArrayList memoryConfigurationSelectionListeners; 212 | private MemoryConfiguration memoryConfiguration; 213 | private boolean[] memoryConfigurationEnables; 214 | 215 | // Constructor 216 | public MemoryConfigurationTableModel () { 217 | memoryConfigurationSelectionListeners = new ArrayList(); 218 | memoryConfiguration = null; 219 | memoryConfigurationEnables = null; 220 | } 221 | 222 | // Make it possible to set a new configuration 223 | public void setMemoryConfiguration (MemoryConfiguration memoryConfiguration) { 224 | if (memoryConfiguration != null) 225 | { 226 | this.memoryConfiguration = memoryConfiguration; 227 | memoryConfigurationEnables = new boolean[memoryConfiguration.getNumberOfSpaces()]; 228 | 229 | for (int i = 0; i < memoryConfigurationEnables.length; i++) 230 | memoryConfigurationEnables[i] = true; 231 | 232 | // Notify listeners 233 | fireTableStructureChanged(); 234 | for (int i = 0; i < memoryConfigurationSelectionListeners.size(); i++) 235 | memoryConfigurationSelectionListeners.get(i).selectionChanged(memoryConfigurationEnables); 236 | } 237 | } 238 | 239 | // Implement/override AbstractTableModel methods 240 | public int getColumnCount() { 241 | return 2; 242 | } 243 | 244 | public Class getColumnClass (int columnIndex) { 245 | return getValueAt(0, columnIndex).getClass(); 246 | } 247 | 248 | public String getColumnName (int columnIndex) { 249 | switch (columnIndex) 250 | { 251 | case 0: return ""; 252 | case 1: return "Name"; 253 | default: return ""; 254 | } 255 | } 256 | 257 | public Object getValueAt(int rowIndex, int columnIndex) { 258 | if (memoryConfiguration == null) 259 | { 260 | if (columnIndex == 0) 261 | return false; 262 | else 263 | return "-"; 264 | } 265 | else 266 | { 267 | switch (columnIndex) 268 | { 269 | case 0: return memoryConfigurationEnables[rowIndex]; 270 | case 1: return memoryConfiguration.getSpace(rowIndex).getName(); 271 | default: return ""; 272 | } 273 | } 274 | } 275 | 276 | public int getRowCount() { 277 | if (memoryConfiguration == null) 278 | return 1; 279 | else 280 | return memoryConfiguration.getNumberOfSpaces(); 281 | } 282 | 283 | public boolean isCellEditable (int rowIndex, int columnIndex) { 284 | if (memoryConfiguration != null && columnIndex == 0) 285 | return true; 286 | else 287 | return false; 288 | } 289 | 290 | public void setValueAt (Object aValue, int rowIndex, int columnIndex) { 291 | if (columnIndex == 0) 292 | { 293 | memoryConfigurationEnables[rowIndex] = (Boolean) aValue; 294 | 295 | // Notify listeners 296 | fireTableCellUpdated(rowIndex, columnIndex); 297 | for (int i = 0; i < memoryConfigurationSelectionListeners.size(); i++) 298 | memoryConfigurationSelectionListeners.get(i).selectionChanged(memoryConfigurationEnables); 299 | } 300 | } 301 | 302 | public void addMemoryConfigurationSelectionListener (MemoryConfigurationSelectionListener memoryConfigurationSelectionListener) { 303 | memoryConfigurationSelectionListeners.add(memoryConfigurationSelectionListener); 304 | } 305 | } 306 | 307 | 308 | class MemoryContentsList extends JList 309 | { 310 | private static final long serialVersionUID = 1L; 311 | 312 | // Attributes 313 | private DefaultListModel memoryContentsListModel; 314 | private MemoryContentsCellRenderer memoryContentsCellRenderer; 315 | 316 | // Constructor 317 | public MemoryContentsList () { 318 | 319 | // Set specific model and renderer 320 | memoryContentsListModel = new DefaultListModel(); 321 | memoryContentsCellRenderer = new MemoryContentsCellRenderer(); 322 | super.setModel(memoryContentsListModel); 323 | super.setCellRenderer(memoryContentsCellRenderer); 324 | super.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 325 | } 326 | 327 | // Update 328 | public void setMemoryContents (MemoryContents memoryContents) { 329 | 330 | // Clear list 331 | memoryContentsListModel.clear(); 332 | 333 | // Add all content, if any 334 | if (memoryContents == null) 335 | return; 336 | for (int i = 0; i < memoryContents.getNumberOfIdentifierContents(); i++) 337 | memoryContentsListModel.addElement(memoryContents.getIdentifierContent(i)); 338 | for (int i = 0; i < memoryContents.getNumberOfDataContents(); i++) 339 | memoryContentsListModel.addElement(memoryContents.getDataContent(i)); 340 | for (int i = 0; i < memoryContents.getNumberOfFillContents(); i++) 341 | memoryContentsListModel.addElement(memoryContents.getFillContent(i)); 342 | } 343 | 344 | // Appearance 345 | private String getMemoryContentsListText (Object object) { 346 | if (object instanceof IdentifierContent) { 347 | IdentifierContent identifierContent = (IdentifierContent) object; 348 | return identifierContent.getIdentifier(); 349 | } else if (object instanceof DataContent) { 350 | DataContent dataContent = (DataContent) object; 351 | return dataContent.getData(); 352 | } else if (object instanceof FillContent) { 353 | FillContent fillContent = (FillContent) object; 354 | return fillContent.getSize() + " byte(s) of " + fillContent.getFill(); 355 | } else { 356 | return object.toString(); 357 | } 358 | } 359 | 360 | class MemoryContentsCellRenderer extends DefaultListCellRenderer 361 | { 362 | private static final long serialVersionUID = 1L; 363 | 364 | public Component getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean hasFocus) { 365 | JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); 366 | label.setText(getMemoryContentsListText(value)); 367 | return label; 368 | } 369 | } 370 | } -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryConfigurationSelectionListener.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer; 2 | 3 | public interface MemoryConfigurationSelectionListener 4 | { 5 | public void selectionChanged (boolean[] memoryConfigurationEnables); 6 | } 7 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryContents/DataContent.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryContents; 2 | 3 | public class DataContent extends MemoryContent 4 | { 5 | // Constants 6 | public static final String DEFAULT_DATA = "?"; 7 | 8 | // Attributes 9 | private String data; 10 | 11 | // Attributes - protection 12 | private boolean isSetData = false; 13 | 14 | // Constructors 15 | public DataContent (long address, long size, String data) { 16 | super(address, size); 17 | setData(data); 18 | } 19 | 20 | public DataContent () { 21 | super(); 22 | this.data = DEFAULT_DATA; 23 | } 24 | 25 | // Getters 26 | public String getData () { 27 | return this.data; 28 | } 29 | 30 | // Setters 31 | public void setData (String data) { 32 | if (!isSetData) { 33 | this.data = data; 34 | isSetData = true; 35 | } 36 | else 37 | System.err.println("The data of the data content can only be set once!"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryContents/FillContent.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryContents; 2 | 3 | public class FillContent extends MemoryContent 4 | { 5 | // Constants 6 | public static int DEFAULT_FILL = -1; 7 | 8 | // Attributes 9 | private int fill; 10 | 11 | // Attributes - protection 12 | private boolean isSetFill = false; 13 | 14 | // Constructors 15 | public FillContent (long address, long size, int fill) { 16 | super(address, size); 17 | setFill(fill); 18 | } 19 | 20 | public FillContent () { 21 | super(); 22 | this.fill = DEFAULT_FILL; 23 | } 24 | 25 | // Getters 26 | public int getFill () { 27 | return this.fill; 28 | } 29 | 30 | // Setters 31 | public void setFill (int fill) { 32 | if (!isSetFill) { 33 | this.fill = fill; 34 | isSetFill = true; 35 | } 36 | else 37 | System.err.println("The fill of the fill content can only be set once!"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryContents/IdentifierContent.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryContents; 2 | 3 | public class IdentifierContent extends MemoryContent 4 | { 5 | // Constants 6 | public static final String UNKNOWN_IDENTIFIER = ">? "; 7 | public static final String DEFAULT_IDENTIFIER = "?"; 8 | public static final String DEFAULT_FILE = "?"; 9 | 10 | // Attributes 11 | private String identifier; 12 | private String file; 13 | 14 | // Attributes - protection 15 | private boolean isSetIdentifier = false; 16 | private boolean isSetFile = false; 17 | 18 | // Constructors 19 | public IdentifierContent (long address, long size, String identifier, String file) { 20 | super(address, size); 21 | setIdentifier(identifier); 22 | setFile(file); 23 | } 24 | 25 | public IdentifierContent () { 26 | super(); 27 | this.identifier = DEFAULT_IDENTIFIER; 28 | this.file = DEFAULT_FILE; 29 | } 30 | 31 | // Getters 32 | public String getIdentifier () { 33 | return this.identifier; 34 | } 35 | 36 | public String getFile () { 37 | return this.file; 38 | } 39 | 40 | // Setters 41 | public void setIdentifier (String identifier) { 42 | if (!isSetIdentifier) { 43 | this.identifier = identifier; 44 | isSetIdentifier = true; 45 | } 46 | else 47 | System.err.println("The identifier of the identifier content can only be set once!"); 48 | } 49 | 50 | public void setFile (String file) { 51 | if (!isSetFile) { 52 | this.file = file; 53 | isSetFile = true; 54 | } 55 | else 56 | System.err.println("The file of the identifier content can only be set once!"); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryContents/MemoryContent.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryContents; 2 | 3 | public class MemoryContent 4 | { 5 | // Constants 6 | public static final long DEFAULT_ADDRESS = -1; 7 | public static final long DEFAULT_SIZE = -1; 8 | 9 | // Attributes 10 | private long address; 11 | private long size; 12 | 13 | // Attributes - protection 14 | private boolean isSetAddress = false; 15 | private boolean isSetSize = false; 16 | 17 | // Constructors 18 | public MemoryContent (long address, long size) { 19 | setAddress(address); 20 | setSize(size); 21 | } 22 | 23 | public MemoryContent () { 24 | this.address = DEFAULT_ADDRESS; 25 | this.size = DEFAULT_SIZE; 26 | } 27 | 28 | // Getters 29 | public long getAddress () { 30 | return this.address; 31 | } 32 | 33 | public long getSize () { 34 | return this.size; 35 | } 36 | 37 | // Setters 38 | public void setAddress (long address) { 39 | if (!isSetAddress) { 40 | this.address = address; 41 | isSetAddress = true; 42 | } 43 | else 44 | System.err.println("The address of the memory content can only be set once!"); 45 | } 46 | 47 | public void setSize (long size) { 48 | if (!isSetSize) { 49 | this.size = size; 50 | isSetSize = true; 51 | } 52 | else 53 | System.err.println("The size of the memory content can only be set once!"); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryContents/MemoryContents.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryContents; 2 | import java.util.ArrayList; 3 | 4 | public class MemoryContents 5 | { 6 | // Attributes 7 | private ArrayList identifierContents; 8 | private ArrayList dataContents; 9 | private ArrayList fillContents; 10 | 11 | // Constructors 12 | public MemoryContents (ArrayList identifierContents, ArrayList dataContents, ArrayList fillContents) { 13 | this.identifierContents = identifierContents; 14 | this.dataContents = dataContents; 15 | this.fillContents = fillContents; 16 | } 17 | 18 | public MemoryContents () { 19 | this.identifierContents = new ArrayList(); 20 | this.dataContents = new ArrayList(); 21 | this.fillContents = new ArrayList(); 22 | } 23 | 24 | // Getters 25 | public int getNumberOfIdentifierContents () { 26 | return this.identifierContents.size(); 27 | } 28 | 29 | public IdentifierContent getIdentifierContent (int identifierContent) { 30 | return this.identifierContents.get(identifierContent); 31 | } 32 | 33 | public int getNumberOfDataContents () { 34 | return this.dataContents.size(); 35 | } 36 | 37 | public DataContent getDataContent (int dataContent) { 38 | return this.dataContents.get(dataContent); 39 | } 40 | 41 | public int getNumberOfFillContents () { 42 | return this.fillContents.size(); 43 | } 44 | 45 | public FillContent getFillContent (int fillContent) { 46 | return this.fillContents.get(fillContent); 47 | } 48 | 49 | // Setters 50 | public void addIdentifierContent (IdentifierContent identifierContent) { 51 | this.identifierContents.add(identifierContent); 52 | } 53 | 54 | public void addDataContent (DataContent dataContent) { 55 | this.dataContents.add(dataContent); 56 | } 57 | 58 | public void addFillContent (FillContent fillContent) { 59 | this.fillContents.add(fillContent); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryContents/MemoryContentsLoader.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryContents; 2 | 3 | public class MemoryContentsLoader 4 | { 5 | // Basic patterns 6 | private static final String fillContent = "*fill*"; 7 | 8 | // Attributes 9 | private static MemoryContents memoryContents; 10 | 11 | // Helper functions - Data 12 | private static int getFill (String fill) { 13 | // e.g.: "ff" returns 255 14 | if (fill == null) 15 | return FillContent.DEFAULT_FILL; 16 | else if (fill.isEmpty()) 17 | return FillContent.DEFAULT_FILL; 18 | else 19 | return Integer.parseInt(fill, 16); 20 | } 21 | 22 | // Helper functions - Loader 23 | public static void clear () { 24 | memoryContents = new MemoryContents(); 25 | } 26 | 27 | public static void addIdentifierContent (long address, long size, String identifier, String file) { 28 | memoryContents.addIdentifierContent(new IdentifierContent(address, size, identifier, file)); 29 | } 30 | 31 | public static void addDataContent (long address, long size, String data) { 32 | memoryContents.addDataContent(new DataContent(address, size, data)); 33 | } 34 | 35 | public static void addFillContent (long address, long size, int fill) { 36 | memoryContents.addFillContent(new FillContent(address, size, fill)); 37 | } 38 | 39 | public static void addOtherContent (long address, long size, String info, String subRegionName) { 40 | 41 | // Determine type of content (identifier, data or fill) 42 | if ((info.contains("/") || info.contains("\\"))) { 43 | addIdentifierContent(address, size, IdentifierContent.UNKNOWN_IDENTIFIER + subRegionName, info); 44 | } else if (subRegionName.equals(fillContent)) { 45 | addFillContent(address, size, getFill(info)); 46 | } else { 47 | addDataContent(address, size, info); 48 | } 49 | } 50 | 51 | // Wrapper - Loader 52 | public static MemoryContents load () { 53 | return memoryContents; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryDetailsComponent.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Dimension; 5 | 6 | import javax.swing.BorderFactory; 7 | import javax.swing.JPanel; 8 | import javax.swing.JTable; 9 | import javax.swing.border.Border; 10 | import javax.swing.border.EtchedBorder; 11 | import javax.swing.table.AbstractTableModel; 12 | 13 | import MemoryViewer.MemoryConfiguration.MemoryConfiguration; 14 | import MemoryViewer.MemoryConfiguration.Space; 15 | import MemoryViewer.MemoryConfiguration.SpaceAttributes; 16 | import MemoryViewer.MemoryContents.DataContent; 17 | import MemoryViewer.MemoryContents.FillContent; 18 | import MemoryViewer.MemoryContents.IdentifierContent; 19 | import MemoryViewer.MemoryContents.MemoryContents; 20 | import MemoryViewer.MemoryMap.MemoryMap; 21 | import MemoryViewer.MemoryMap.Region; 22 | import MemoryViewer.MemoryMap.RegionData; 23 | import MemoryViewer.MemoryMap.SubRegion; 24 | 25 | public class MemoryDetailsComponent extends JPanel implements MemoryDetailsListener 26 | { 27 | private static final long serialVersionUID = 1L; 28 | 29 | // Details table 30 | private DetailsTableModel detailsTableModel; 31 | private JTable detailsTable; 32 | private JPanel memoryDetailsPanel; 33 | private Border memoryDetailsBorder; 34 | 35 | // Constructor 36 | public MemoryDetailsComponent () { 37 | 38 | // Create contents 39 | detailsTableModel = new DetailsTableModel(); 40 | detailsTable = new JTable(detailsTableModel); 41 | memoryDetailsPanel = new JPanel(new BorderLayout()); 42 | memoryDetailsBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Memory Details"); 43 | 44 | // Bind contents 45 | setLayout(new BorderLayout()); 46 | add(memoryDetailsPanel, BorderLayout.CENTER); 47 | memoryDetailsPanel.add(detailsTable.getTableHeader(), BorderLayout.NORTH); 48 | memoryDetailsPanel.add(detailsTable, BorderLayout.CENTER); 49 | memoryDetailsPanel.setBorder(memoryDetailsBorder); 50 | 51 | // Set preferred sizes 52 | memoryDetailsPanel.setPreferredSize(new Dimension(300, 700)); 53 | } 54 | 55 | public void showDetails (Object object) { 56 | detailsTableModel.setDetails(object); 57 | } 58 | } 59 | 60 | 61 | class DetailsTableModel extends AbstractTableModel 62 | { 63 | private static final long serialVersionUID = 1L; 64 | 65 | // Attributes 66 | private String[] properties; 67 | private Object[] values; 68 | 69 | // Constructor 70 | public DetailsTableModel () { 71 | properties = new String[1]; 72 | values = new Object[1]; 73 | properties[0] = ""; 74 | values[0] = ""; 75 | } 76 | 77 | // Helpers 78 | private String toLargeHexString (long number) 79 | { 80 | number &= 0xFFFFFFFF; 81 | return "0x" + Long.toHexString(0x100000000L | number).substring(1).toUpperCase(); 82 | } 83 | 84 | // Make it possible to set a new details object 85 | public void setDetails (Object detailsObject) { 86 | if (detailsObject != null) { 87 | 88 | if (detailsObject instanceof MemoryMap) { 89 | load((MemoryMap) detailsObject); 90 | } else if (detailsObject instanceof Region) { 91 | load((Region) detailsObject); 92 | } else if (detailsObject instanceof SubRegion) { 93 | load((SubRegion) detailsObject); 94 | } else if (detailsObject instanceof RegionData) { 95 | load((RegionData) detailsObject); 96 | } else if (detailsObject instanceof MemoryConfiguration) { 97 | load((MemoryConfiguration) detailsObject); 98 | } else if (detailsObject instanceof Space) { 99 | load((Space) detailsObject); 100 | } else if (detailsObject instanceof SpaceAttributes) { 101 | load((SpaceAttributes) detailsObject); 102 | } else if (detailsObject instanceof MemoryContents) { 103 | load((MemoryContents) detailsObject); 104 | } else if (detailsObject instanceof IdentifierContent) { 105 | load((IdentifierContent) detailsObject); 106 | } else if (detailsObject instanceof DataContent) { 107 | load((DataContent) detailsObject); 108 | } else if (detailsObject instanceof FillContent) { 109 | load((FillContent) detailsObject); 110 | } else { 111 | load(detailsObject.toString()); 112 | } 113 | 114 | fireTableStructureChanged(); 115 | } 116 | } 117 | 118 | // Implement/override AbstractTableModel methods 119 | public int getColumnCount() { 120 | return 2; 121 | } 122 | 123 | public Class getColumnClass (int columnIndex) { 124 | return String.class; 125 | } 126 | 127 | public String getColumnName (int columnIndex) { 128 | switch (columnIndex) 129 | { 130 | case 0: return "Property"; 131 | case 1: return "Value"; 132 | default: return ""; 133 | } 134 | } 135 | 136 | public Object getValueAt(int rowIndex, int columnIndex) { 137 | switch (columnIndex) 138 | { 139 | case 0: return properties[rowIndex]; 140 | case 1: return values[rowIndex]; 141 | default: return ""; 142 | } 143 | } 144 | 145 | public int getRowCount() { 146 | return properties.length; 147 | } 148 | 149 | public boolean isCellEditable (int rowIndex, int columnIndex) { 150 | return false; 151 | } 152 | 153 | // Different details loaders 154 | private void load (MemoryMap memoryMap) { 155 | properties = new String[2]; 156 | values = new Object[2]; 157 | 158 | properties[0] = "Type"; values[0] = "MemoryMap"; 159 | properties[1] = "Number of regions"; values[1] = memoryMap.getNumberOfRegions(); 160 | } 161 | 162 | private void load (Region region) { 163 | properties = new String[7]; 164 | values = new Object[7]; 165 | 166 | properties[0] = "Type"; values[0] = "Region"; 167 | properties[1] = "Number of subregions"; values[1] = region.getNumberOfSubRegions(); 168 | properties[2] = "Name"; values[2] = region.getName(); 169 | properties[3] = "Fill"; values[3] = region.getFill(); 170 | properties[4] = "Address"; values[4] = toLargeHexString(region.getData().getAddress()); 171 | properties[5] = "Size"; values[5] = region.getData().getSize(); 172 | properties[6] = "Info"; values[6] = region.getData().getInfo(); 173 | } 174 | 175 | private void load (SubRegion subRegion) { 176 | properties = new String[3]; 177 | values = new Object[3]; 178 | 179 | properties[0] = "Type"; values[0] = "SubRegion"; 180 | properties[1] = "Number of regiondata"; values[1] = subRegion.getNumberOfRegionData(); 181 | properties[2] = "Name"; values[2] = subRegion.getName(); 182 | } 183 | 184 | private void load (RegionData regionData) { 185 | properties = new String[4]; 186 | values = new Object[4]; 187 | 188 | properties[0] = "Type"; values[0] = "RegionData"; 189 | properties[1] = "Address"; values[1] = toLargeHexString(regionData.getAddress()); 190 | properties[2] = "Size"; values[2] = regionData.getSize(); 191 | properties[3] = "Info"; values[3] = regionData.getInfo(); 192 | } 193 | 194 | private void load (MemoryConfiguration memoryConfiguration) { 195 | properties = new String[3]; 196 | values = new Object[3]; 197 | 198 | properties[0] = "Type"; values[0] = "MemoryConfiguration"; 199 | properties[1] = "Number of spaces"; values[1] = memoryConfiguration.getNumberOfSpaces(); 200 | properties[2] = "Total size"; values[2] = memoryConfiguration.getTotalSize(); 201 | } 202 | 203 | private void load (Space space) { 204 | properties = new String[7]; 205 | values = new Object[7]; 206 | 207 | properties[0] = "Type"; values[0] = "Space"; 208 | properties[1] = "Name"; values[1] = space.getName(); 209 | properties[2] = "Origin"; values[2] = toLargeHexString(space.getOrigin()); 210 | properties[3] = "Length"; values[3] = toLargeHexString(space.getLength()); 211 | properties[4] = "Erasable"; values[4] = space.getAttributes().isErasable(); 212 | properties[5] = "Readable"; values[5] = space.getAttributes().isReadable(); 213 | properties[6] = "Writable"; values[6] = space.getAttributes().isWritable(); 214 | } 215 | 216 | private void load (SpaceAttributes spaceAttributes) { 217 | properties = new String[4]; 218 | values = new Object[4]; 219 | 220 | properties[0] = "Type"; values[0] = "SpaceAttributes"; 221 | properties[1] = "Erasable"; values[1] = spaceAttributes.isErasable(); 222 | properties[2] = "Readable"; values[2] = spaceAttributes.isReadable(); 223 | properties[3] = "Writable"; values[3] = spaceAttributes.isWritable(); 224 | } 225 | 226 | private void load (MemoryContents memoryContents) { 227 | properties = new String[4]; 228 | values = new Object[4]; 229 | 230 | properties[0] = "Type"; values[0] = "MemoryContents"; 231 | properties[1] = "Number of identifiers"; values[1] = memoryContents.getNumberOfIdentifierContents(); 232 | properties[2] = "Number of datas"; values[2] = memoryContents.getNumberOfDataContents(); 233 | properties[3] = "Number of fills"; values[3] = memoryContents.getNumberOfFillContents(); 234 | } 235 | 236 | private void load (IdentifierContent identifierContent) { 237 | properties = new String[5]; 238 | values = new Object[5]; 239 | 240 | properties[0] = "Type"; values[0] = "IdentifierContent"; 241 | properties[1] = "Identifier"; values[1] = identifierContent.getIdentifier(); 242 | properties[2] = "File"; values[2] = identifierContent.getFile(); 243 | properties[3] = "Address"; values[3] = toLargeHexString(identifierContent.getAddress()); 244 | properties[4] = "Size"; values[4] = identifierContent.getSize(); 245 | } 246 | 247 | private void load (DataContent dataContent) { 248 | properties = new String[4]; 249 | values = new Object[4]; 250 | 251 | properties[0] = "Type"; values[0] = "DataContent"; 252 | properties[1] = "Data"; values[1] = dataContent.getData(); 253 | properties[2] = "Address"; values[2] = toLargeHexString(dataContent.getAddress()); 254 | properties[3] = "Size"; values[3] = dataContent.getSize(); 255 | } 256 | 257 | private void load (FillContent fillContent) { 258 | properties = new String[4]; 259 | values = new Object[4]; 260 | 261 | properties[0] = "Type"; values[0] = "FillContent"; 262 | properties[1] = "Fill"; values[1] = fillContent.getFill(); 263 | properties[2] = "Address"; values[2] = toLargeHexString(fillContent.getAddress()); 264 | properties[3] = "Size"; values[3] = fillContent.getSize(); 265 | } 266 | 267 | private void load (String string) { 268 | properties = new String[1]; 269 | values = new Object[1]; 270 | 271 | properties[0] = ""; values[0] = string; 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryDetailsListener.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer; 2 | 3 | public interface MemoryDetailsListener 4 | { 5 | public void showDetails (Object object); 6 | } 7 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryInfoFactory.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileNotFoundException; 6 | import java.io.FileReader; 7 | import java.io.IOException; 8 | 9 | import MemoryViewer.MemoryConfiguration.MemoryConfiguration; 10 | import MemoryViewer.MemoryConfiguration.MemoryConfigurationLoader; 11 | import MemoryViewer.MemoryContents.MemoryContents; 12 | import MemoryViewer.MemoryContents.MemoryContentsLoader; 13 | import MemoryViewer.MemoryMap.MemoryMap; 14 | import MemoryViewer.MemoryMap.MemoryMapCompressor; 15 | import MemoryViewer.MemoryMap.MemoryMapFilter; 16 | import MemoryViewer.MemoryMap.MemoryMapLoader; 17 | 18 | public class MemoryInfoFactory 19 | { 20 | // Attributes 21 | private MemoryConfiguration memoryConfiguration; 22 | private MemoryContents memoryContents; 23 | private MemoryMap rawMemoryMap; 24 | private MemoryMap filteredMemoryMap; 25 | private MemoryMap compressedMemoryMap; 26 | 27 | // Constructor 28 | public MemoryInfoFactory () { 29 | memoryConfiguration = null; 30 | memoryContents = null; 31 | rawMemoryMap = null; 32 | filteredMemoryMap = null; 33 | compressedMemoryMap = null; 34 | } 35 | 36 | // Memory info creator 37 | public void load (File file) 38 | { 39 | try 40 | { 41 | // Load the configuration 42 | FileReader fileReader = new FileReader(file); 43 | BufferedReader bufferedReader = new BufferedReader(fileReader); 44 | memoryConfiguration = MemoryConfigurationLoader.load(bufferedReader); 45 | bufferedReader.close(); 46 | fileReader.close(); 47 | 48 | // Load, filter and compress the map 49 | fileReader = new FileReader(file); 50 | bufferedReader = new BufferedReader(fileReader); 51 | rawMemoryMap = MemoryMapLoader.load(bufferedReader); 52 | filteredMemoryMap = MemoryMapFilter.filter(rawMemoryMap); 53 | compressedMemoryMap = MemoryMapCompressor.compress(filteredMemoryMap); 54 | bufferedReader.close(); 55 | fileReader.close(); 56 | 57 | // Load the contents (actually created by the compressor!) 58 | memoryContents = MemoryContentsLoader.load(); 59 | } 60 | catch (FileNotFoundException e) { 61 | System.err.println(e.toString()); 62 | } 63 | catch (IOException e) { 64 | System.err.println(e.toString()); 65 | } 66 | } 67 | 68 | // Getters 69 | public MemoryConfiguration getMemoryConfiguration () { 70 | return memoryConfiguration; 71 | } 72 | 73 | public MemoryContents getMemoryContents () { 74 | return memoryContents; 75 | } 76 | 77 | public MemoryMap getRawMemoryMap () { 78 | return rawMemoryMap; 79 | } 80 | 81 | public MemoryMap getFilteredMemoryMap () { 82 | return filteredMemoryMap; 83 | } 84 | 85 | public MemoryMap getCompressedMemoryMap () { 86 | return compressedMemoryMap; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryInfoUpdateListener.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer; 2 | 3 | public interface MemoryInfoUpdateListener 4 | { 5 | public void update (MemoryInfoFactory memoryInfoFactory); 6 | } 7 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryMap/MemoryMap.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryMap; 2 | import java.util.ArrayList; 3 | 4 | public class MemoryMap 5 | { 6 | // Attributes 7 | private ArrayList regions; 8 | 9 | // Constructors 10 | public MemoryMap (ArrayList regions) { 11 | this.regions = regions; 12 | } 13 | 14 | public MemoryMap () { 15 | this.regions = new ArrayList(); 16 | } 17 | 18 | // Getters 19 | public int getNumberOfRegions () { 20 | return this.regions.size(); 21 | } 22 | 23 | public Region getRegion (int region) { 24 | return this.regions.get(region); 25 | } 26 | 27 | // Setters 28 | public void addRegion (Region region) { 29 | for (int i = 0; i < regions.size(); i++) { 30 | if (regions.get(i).getData().getAddress() > region.getData().getAddress()) { 31 | regions.add(i, region); 32 | return; 33 | } 34 | } 35 | regions.add(region); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryMap/MemoryMapCompressor.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryMap; 2 | import MemoryViewer.MemoryContents.MemoryContentsLoader; 3 | 4 | public class MemoryMapCompressor 5 | { 6 | // Attributes - temporary storage of regiondata 7 | private static long address; 8 | private static long size; 9 | private static String info; 10 | private static boolean used; 11 | 12 | // Helper functions - temporary storage of regiondata 13 | private static boolean isStored () { 14 | return (size > 0); 15 | } 16 | 17 | private static void clearStorage () { 18 | size = RegionData.DEFAULT_SIZE; 19 | } 20 | 21 | private static void setUsed () { 22 | used = true; 23 | } 24 | 25 | private static long getEndAddress () { 26 | if (!isStored()) 27 | return RegionData.DEFAULT_ADDRESS; 28 | else 29 | return address + size; 30 | } 31 | 32 | private static boolean isToBeStored (RegionData regionData) { 33 | return ((regionData.getAddress() != RegionData.DEFAULT_ADDRESS) && (regionData.getSize() > 0)); 34 | } 35 | 36 | private static void store (RegionData regionData) { 37 | address = regionData.getAddress(); 38 | size = regionData.getSize(); 39 | info = regionData.getInfo(); 40 | used = false; 41 | } 42 | 43 | private static boolean isLeftToBeAdded () { 44 | return (isStored() && !used); 45 | } 46 | 47 | private static RegionData add () { 48 | return new RegionData(address, size, info); 49 | } 50 | 51 | private static boolean isToBeMerged (RegionData regionData) { 52 | return (isStored() && (regionData.getAddress() < getEndAddress()) && (regionData.getSize() == RegionData.DEFAULT_SIZE)); 53 | } 54 | 55 | private static RegionData merge (RegionData regionData, long mergeSize) { 56 | return new RegionData(regionData.getAddress(), mergeSize, regionData.getInfo() + " (" + info + ")"); 57 | } 58 | 59 | // Method to compress maps 60 | public static MemoryMap compress (MemoryMap map) 61 | { 62 | // Start gathering new memory contents 63 | MemoryContentsLoader.clear(); 64 | 65 | MemoryMap compressedMap = new MemoryMap(); 66 | for (int i = 0; i < map.getNumberOfRegions(); i++) 67 | { 68 | Region region = map.getRegion(i); 69 | Region compressedRegion = new Region(); 70 | compressedRegion.setName(region.getName()); 71 | compressedRegion.setData(region.getData()); 72 | compressedRegion.setFill(region.getFill()); 73 | for (int j = 0; j < region.getNumberOfSubRegions(); j++) 74 | { 75 | SubRegion subRegion = region.getSubRegion(j); 76 | SubRegion compressedSubRegion = new SubRegion(); 77 | compressedSubRegion.setName(subRegion.getName()); 78 | 79 | // Start of compression 80 | clearStorage(); 81 | for (int k = 0; k < subRegion.getNumberOfRegionData(); k++) 82 | { 83 | RegionData regionData = subRegion.getRegionData(k); 84 | 85 | if (isToBeStored(regionData)) 86 | { 87 | // Store it, but first save anything left in storage not already used 88 | if (isLeftToBeAdded()) 89 | { 90 | compressedSubRegion.addData(add()); 91 | MemoryContentsLoader.addOtherContent(address, size, info, subRegion.getName()); 92 | } 93 | store(regionData); 94 | } 95 | else if (isToBeMerged(regionData)) 96 | { 97 | // Add the merged data, keep in storage, but note that it has been used 98 | long mergeSize = RegionData.DEFAULT_SIZE; 99 | if ((k + 1) < subRegion.getNumberOfRegionData()) { 100 | RegionData nextRegionData = subRegion.getRegionData(k + 1); 101 | if (nextRegionData.getAddress() <= getEndAddress()) 102 | mergeSize = nextRegionData.getAddress() - regionData.getAddress(); 103 | else 104 | mergeSize = getEndAddress() - regionData.getAddress(); 105 | } else { 106 | mergeSize = getEndAddress() - regionData.getAddress(); 107 | } 108 | 109 | setUsed(); 110 | compressedSubRegion.addData(merge(regionData, mergeSize)); 111 | MemoryContentsLoader.addIdentifierContent(regionData.getAddress(), mergeSize, regionData.getInfo(), info); 112 | } 113 | //else 114 | //{ 115 | // System.out.println("Unexpected data format while compressing..."); 116 | //} 117 | } 118 | if (isLeftToBeAdded()) 119 | { 120 | compressedSubRegion.addData(add()); 121 | MemoryContentsLoader.addOtherContent(address, size, info, subRegion.getName()); 122 | } 123 | // End of compression 124 | 125 | if (compressedSubRegion.getNumberOfRegionData() > 0) 126 | compressedRegion.addSubRegion(compressedSubRegion); 127 | } 128 | 129 | if (compressedRegion.getNumberOfSubRegions() > 0) 130 | compressedMap.addRegion(compressedRegion); 131 | } 132 | 133 | // Memory contents have been gathered 134 | return compressedMap; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryMap/MemoryMapFilter.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryMap; 2 | 3 | public class MemoryMapFilter 4 | { 5 | public static MemoryMap filter (MemoryMap map) 6 | { 7 | MemoryMap filteredMap = new MemoryMap(); 8 | for (int i = 0; i < map.getNumberOfRegions(); i++) 9 | { 10 | Region filteredRegion = filter(map.getRegion(i)); 11 | if (filteredRegion.getNumberOfSubRegions() > 0) 12 | filteredMap.addRegion(filteredRegion); 13 | } 14 | return filteredMap; 15 | } 16 | 17 | private static Region filter (Region region) 18 | { 19 | Region filteredRegion = new Region(); 20 | filteredRegion.setName(region.getName()); 21 | filteredRegion.setData(region.getData()); 22 | filteredRegion.setFill(region.getFill()); 23 | for (int i = 0; i < region.getNumberOfSubRegions(); i++) 24 | { 25 | SubRegion filteredSubRegion = filter(region.getSubRegion(i)); 26 | if (filteredSubRegion.getNumberOfRegionData() > 0) 27 | filteredRegion.addSubRegion(filteredSubRegion); 28 | } 29 | return filteredRegion; 30 | } 31 | 32 | private static SubRegion filter (SubRegion subRegion) 33 | { 34 | SubRegion filteredSubRegion = new SubRegion(); 35 | filteredSubRegion.setName(subRegion.getName()); 36 | for (int i = 0; i < subRegion.getNumberOfRegionData(); i++) 37 | { 38 | RegionData filteredRegionData = subRegion.getRegionData(i); 39 | if (passesFilter(filteredRegionData)) 40 | filteredSubRegion.addData(filteredRegionData); 41 | } 42 | return filteredSubRegion; 43 | } 44 | 45 | private static boolean passesFilter (RegionData regionData) 46 | { 47 | String info = regionData.getInfo(); 48 | boolean validInfo = !(info.contains(" = ") || info.contains("PROVIDE") || info.contains("ASSERT") || info.contains("linker stubs")); 49 | boolean validAddress = (regionData.getAddress() != RegionData.DEFAULT_ADDRESS); 50 | 51 | return validInfo && validAddress; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryMap/MemoryMapLoader.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryMap; 2 | import java.io.BufferedReader; 3 | import java.io.IOException; 4 | import java.util.regex.Matcher; 5 | import java.util.regex.Pattern; 6 | 7 | 8 | public class MemoryMapLoader 9 | { 10 | // Basic patterns 11 | private static final String startMap = "Linker script and memory map"; 12 | private static final String endMap = "OUTPUT("; 13 | private static final String regexOfRegion = "(\\.[a-zA-Z_][\\.a-zA-Z0-9_]*)"; 14 | private static final String regexOfSubRegion = " ([C\\.\\*]{1}\\S+( \\.\\S+)?)"; 15 | private static final String regexOfAddress = "(0x[a-fA-F0-9]{8})"; 16 | private static final String regexOfSize = "(0x[a-fA-F0-9]+)"; 17 | private static final String regexOfFill = " FILL mask (0x[a-fA-F0-9]+)"; 18 | 19 | // Compiled patters 20 | private static final Pattern patternOfFill = Pattern.compile(regexOfFill); 21 | private static final Pattern patternFindRegion = Pattern.compile(regexOfRegion + "(.*)"); 22 | private static final Pattern patternEndOfRegion = patternFindRegion; 23 | private static final Pattern patternFindSubRegion = Pattern.compile(regexOfSubRegion + "(.*)"); 24 | private static final Pattern patternEndOfSubRegion = Pattern.compile(" ?[C\\.\\*]{1}\\S+.*"); 25 | private static final Pattern patternRegionData = Pattern.compile("\\s+" + regexOfAddress + "\\s+" + regexOfSize + "\\s*(.*)?$"); 26 | private static final Pattern patternSubRegionData = Pattern.compile("\\s+" + regexOfAddress + "\\s+" + regexOfSize + "?\\s*(.*)$"); 27 | 28 | // Helper functions - Data 29 | private static long getAddress (String address) { 30 | // e.g.: "0x00000314" returns 788 31 | if (address == null) 32 | return RegionData.DEFAULT_ADDRESS; 33 | else 34 | return Long.parseLong(address.substring(2, address.length()), 16); 35 | } 36 | 37 | private static long getSize (String size) { 38 | // e.g.: "0x4" returns 4 39 | if (size == null) 40 | return RegionData.DEFAULT_SIZE; 41 | else 42 | return Long.parseLong(size.substring(2, size.length()), 16); 43 | } 44 | 45 | private static int getFill (String fill) { 46 | // e.g.: "0xff" returns 255 47 | if (fill == null) 48 | return Region.DEFAULT_FILL; 49 | else 50 | return Integer.parseInt(fill.substring(2, fill.length()), 16); 51 | } 52 | 53 | // Helper functions - Reader 54 | private static BufferedReader reader; 55 | private static String readerLine; 56 | 57 | private static String getNextLine () 58 | { 59 | // Read next line (skip blank lines) and store it AND return it 60 | try 61 | { 62 | while (readerLine != null) 63 | { 64 | readerLine = reader.readLine(); 65 | if (readerLine.length() != 0) 66 | return readerLine; 67 | } 68 | } 69 | catch (IOException e) 70 | { 71 | System.err.println("Error reading next line: " + e.getMessage()); 72 | } 73 | 74 | return readerLine; 75 | } 76 | 77 | // Helper functions - Loader 78 | private static MemoryMap loadMap () 79 | { 80 | MemoryMap todoMap = new MemoryMap(); 81 | 82 | // Find the start of the memory map 83 | while (!readerLine.startsWith(startMap)) 84 | getNextLine(); 85 | 86 | Matcher matcher = patternFindRegion.matcher(readerLine); 87 | while (!matcher.matches() && !readerLine.startsWith(endMap)) 88 | { 89 | getNextLine(); 90 | matcher = patternFindRegion.matcher(readerLine); 91 | } 92 | 93 | // Parse and store the regions of the memory map 94 | while (matcher.matches() && !readerLine.startsWith(endMap)) 95 | { 96 | todoMap.addRegion(loadRegion()); 97 | matcher = patternFindRegion.matcher(readerLine); 98 | } 99 | 100 | return todoMap; 101 | } 102 | 103 | private static Region loadRegion () 104 | { 105 | Region todoRegion = new Region(); 106 | 107 | // Find name, data, fill and subregions 108 | Matcher matcher = patternFindRegion.matcher(readerLine); 109 | if (matcher.matches()) 110 | { 111 | // Get name and data 112 | todoRegion.setName(matcher.group(1)); 113 | if (matcher.group(2).length() != 0) 114 | { 115 | // Data on the same line 116 | readerLine = matcher.group(2); 117 | todoRegion.setData(loadRegionData()); 118 | } 119 | else 120 | { 121 | // Data on the next line 122 | getNextLine(); 123 | todoRegion.setData(loadRegionData()); 124 | } 125 | 126 | // Check next line for fill 127 | getNextLine(); 128 | matcher = patternOfFill.matcher(readerLine); 129 | if (matcher.matches()) 130 | { 131 | todoRegion.setFill(getFill(matcher.group(1))); 132 | getNextLine(); 133 | } 134 | 135 | // Add subregions 136 | matcher = patternEndOfRegion.matcher(readerLine); 137 | while (!matcher.matches() && !readerLine.startsWith(endMap)) 138 | { 139 | todoRegion.addSubRegion(loadSubRegion()); 140 | matcher = patternEndOfRegion.matcher(readerLine); 141 | } 142 | } 143 | 144 | return todoRegion; 145 | } 146 | 147 | private static SubRegion loadSubRegion () 148 | { 149 | SubRegion todoSubRegion = new SubRegion(); 150 | 151 | // Find name and data 152 | Matcher matcher = patternFindSubRegion.matcher(readerLine); 153 | if (matcher.matches()) 154 | { 155 | todoSubRegion.setName(matcher.group(1)); 156 | if (matcher.group(3).length() != 0) 157 | { 158 | // First data on the same line 159 | readerLine = matcher.group(3); 160 | todoSubRegion.addData(loadSubRegionData()); 161 | } 162 | } 163 | else 164 | { 165 | // Nameless subregion, just only add data 166 | todoSubRegion.addData(loadSubRegionData()); 167 | } 168 | 169 | // More data on next line or no more data for this subregion 170 | getNextLine(); 171 | matcher = patternEndOfSubRegion.matcher(readerLine); 172 | while (!matcher.matches() && !readerLine.startsWith(endMap)) 173 | { 174 | todoSubRegion.addData(loadSubRegionData()); 175 | getNextLine(); 176 | matcher = patternEndOfSubRegion.matcher(readerLine); 177 | } 178 | 179 | return todoSubRegion; 180 | } 181 | 182 | private static RegionData loadRegionData () 183 | { 184 | RegionData todoRegionData = new RegionData(); 185 | 186 | // Find address, size and info (optional!) 187 | Matcher matcher = patternRegionData.matcher(readerLine); 188 | if (matcher.matches()) 189 | { 190 | todoRegionData.setAddress(getAddress(matcher.group(1))); 191 | todoRegionData.setSize(getSize(matcher.group(2))); 192 | if (matcher.groupCount() == 3) 193 | todoRegionData.setInfo(matcher.group(3)); 194 | } 195 | 196 | return todoRegionData; 197 | } 198 | 199 | private static RegionData loadSubRegionData () 200 | { 201 | RegionData todoRegionData = new RegionData(); 202 | 203 | // Find address, size (optional!) and info 204 | Matcher matcher = patternSubRegionData.matcher(readerLine); 205 | if (matcher.matches()) 206 | { 207 | todoRegionData.setAddress(getAddress(matcher.group(1))); 208 | todoRegionData.setInfo(matcher.group(matcher.groupCount())); 209 | if (matcher.groupCount() == 3) 210 | todoRegionData.setSize(getSize(matcher.group(2))); 211 | } 212 | 213 | return todoRegionData; 214 | } 215 | 216 | // Wrapper - Loader 217 | public static MemoryMap load (BufferedReader bufferedReader) 218 | { 219 | // Wrap to other loaders, using one buffered reader 220 | reader = bufferedReader; 221 | readerLine = ""; 222 | return loadMap(); 223 | } 224 | } 225 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryMap/Region.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryMap; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class Region 6 | { 7 | // Constants 8 | public static final String DEFAULT_NAME = ""; 9 | public static final RegionData DEFAULT_DATA = null; 10 | public static final int DEFAULT_FILL = -1; 11 | 12 | // Attributes 13 | private String name; 14 | private RegionData data; 15 | private int fill; 16 | private ArrayList subRegions; 17 | 18 | // Attributes - protection 19 | private boolean isSetName = false; 20 | private boolean isSetData = false; 21 | private boolean isSetFill = false; 22 | 23 | // Constructors 24 | public Region (String name, RegionData data, int fill, ArrayList subRegions) { 25 | setName(name); 26 | setData(data); 27 | setFill(fill); 28 | this.subRegions = subRegions; 29 | } 30 | 31 | public Region () { 32 | this.name = DEFAULT_NAME; 33 | this.data = DEFAULT_DATA; 34 | this.fill = DEFAULT_FILL; 35 | this.subRegions = new ArrayList(); 36 | } 37 | 38 | // Getters 39 | public String getName () { 40 | return this.name; 41 | } 42 | 43 | public RegionData getData () { 44 | return this.data; 45 | } 46 | 47 | public int getFill () { 48 | return this.fill; 49 | } 50 | 51 | public int getNumberOfSubRegions () { 52 | return this.subRegions.size(); 53 | } 54 | 55 | public SubRegion getSubRegion (int subRegion) { 56 | return this.subRegions.get(subRegion); 57 | } 58 | 59 | // Setters 60 | public void setName (String name) { 61 | if (!isSetName) { 62 | this.name = name; 63 | isSetName = true; 64 | } 65 | else 66 | System.err.println("The name of the region can only be set once!"); 67 | } 68 | 69 | public void setData (RegionData data) { 70 | if (!isSetData) { 71 | this.data = data; 72 | isSetData = true; 73 | } 74 | else 75 | System.err.println("The data of the region can only be set once!"); 76 | } 77 | 78 | public void setFill (int fill) { 79 | if (!isSetFill) { 80 | this.fill = fill; 81 | isSetFill = true; 82 | } 83 | else 84 | System.err.println("The fill of the region can only be set once!"); 85 | } 86 | 87 | public void addSubRegion (SubRegion subRegion) { 88 | for (int i = 0; i < subRegions.size(); i++) { 89 | if (subRegions.get(i).getNumberOfRegionData() > 0 && subRegion.getNumberOfRegionData() > 0) { 90 | if (subRegions.get(i).getRegionData(0).getAddress() > subRegion.getRegionData(0).getAddress()) { 91 | subRegions.add(i, subRegion); 92 | return; 93 | } 94 | } 95 | } 96 | subRegions.add(subRegion); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryMap/RegionData.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryMap; 2 | 3 | public class RegionData 4 | { 5 | // Constants 6 | public static final long DEFAULT_ADDRESS = -1; 7 | public static final long DEFAULT_SIZE = -1; 8 | public static final String DEFAULT_INFO = ""; 9 | 10 | // Attributes 11 | private long address; 12 | private long size; 13 | private String info; 14 | 15 | // Attributes - protection 16 | private boolean isSetAddress = false; 17 | private boolean isSetSize = false; 18 | private boolean isSetInfo = false; 19 | 20 | // Constructors 21 | public RegionData (long address, long size, String info) { 22 | setAddress(address); 23 | setSize(size); 24 | setInfo(info); 25 | } 26 | 27 | public RegionData () { 28 | this.address = DEFAULT_ADDRESS; 29 | this.size = DEFAULT_SIZE; 30 | this.info = DEFAULT_INFO; 31 | } 32 | 33 | // Getters 34 | public long getAddress () { 35 | return this.address; 36 | } 37 | 38 | public long getSize () { 39 | return this.size; 40 | } 41 | 42 | public String getInfo () { 43 | return this.info; 44 | } 45 | 46 | // Setters 47 | public void setAddress (long address) { 48 | if (!isSetAddress) { 49 | this.address = address; 50 | isSetAddress = true; 51 | } 52 | else 53 | System.err.println("The address of the region data can only be set once!"); 54 | } 55 | 56 | public void setSize (long size) { 57 | if (!isSetSize) { 58 | this.size = size; 59 | isSetSize = true; 60 | } 61 | else 62 | System.err.println("The size of the region data can only be set once!"); 63 | } 64 | 65 | public void setInfo (String info) { 66 | if (!isSetInfo) { 67 | this.info = info; 68 | isSetInfo = true; 69 | } 70 | else 71 | System.err.println("The info of the region data can only be set once!"); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryMap/SubRegion.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer.MemoryMap; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class SubRegion 6 | { 7 | // Constants 8 | public static final String DEFAULT_NAME = ""; 9 | 10 | // Attributes 11 | private String name; 12 | private ArrayList data; 13 | 14 | // Attributes - protection 15 | private boolean isSetName = false; 16 | 17 | // Constructors 18 | public SubRegion (String name, ArrayList data) { 19 | setName(name); 20 | this.data = data; 21 | } 22 | 23 | public SubRegion () { 24 | this.name = DEFAULT_NAME; 25 | this.data = new ArrayList(); 26 | } 27 | 28 | // Getters 29 | public String getName () { 30 | return this.name; 31 | } 32 | 33 | public int getNumberOfRegionData () { 34 | return this.data.size(); 35 | } 36 | 37 | public RegionData getRegionData (int regionData) { 38 | return this.data.get(regionData); 39 | } 40 | 41 | // Setters 42 | public void setName (String name) { 43 | if (!isSetName) { 44 | this.name = name; 45 | isSetName = true; 46 | } 47 | else 48 | System.err.println("The name of the subregion can only be set once!"); 49 | } 50 | 51 | public void addData (RegionData data) { 52 | for (int i = 0; i < this.data.size(); i++) { 53 | if (this.data.get(i).getAddress() > data.getAddress()) { 54 | this.data.add(i, data); 55 | return; 56 | } 57 | } 58 | this.data.add(data); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryMapComponent.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Dimension; 6 | import java.awt.Graphics; 7 | import java.awt.GridLayout; 8 | import java.awt.Rectangle; 9 | import java.awt.event.ActionEvent; 10 | import java.awt.event.ActionListener; 11 | import java.awt.event.ItemEvent; 12 | import java.awt.event.ItemListener; 13 | import java.util.ArrayList; 14 | 15 | import javax.swing.BorderFactory; 16 | import javax.swing.JButton; 17 | import javax.swing.JComboBox; 18 | import javax.swing.JPanel; 19 | import javax.swing.JScrollPane; 20 | import javax.swing.JSplitPane; 21 | import javax.swing.JTree; 22 | import javax.swing.border.Border; 23 | import javax.swing.border.EtchedBorder; 24 | import javax.swing.event.TreeSelectionEvent; 25 | import javax.swing.event.TreeSelectionListener; 26 | import javax.swing.tree.DefaultMutableTreeNode; 27 | import javax.swing.tree.DefaultTreeModel; 28 | import javax.swing.tree.TreeSelectionModel; 29 | 30 | import MemoryViewer.MemoryMap.MemoryMap; 31 | import MemoryViewer.MemoryMap.Region; 32 | import MemoryViewer.MemoryMap.RegionData; 33 | import MemoryViewer.MemoryMap.SubRegion; 34 | 35 | public class MemoryMapComponent extends JPanel implements MemoryInfoUpdateListener, TreeSelectionListener, ItemListener, ActionListener 36 | { 37 | private static final long serialVersionUID = 1L; 38 | 39 | // Constants 40 | private static final String SELECTION_RAW = "Raw"; 41 | private static final String SELECTION_FILTERED = "Filtered"; 42 | private static final String SELECTION_COMPRESSED = "Compressed"; 43 | 44 | // Listeners 45 | private ArrayList memoryDetailsListeners; 46 | 47 | // Memory info 48 | private MemoryMap rawMemoryMap; 49 | private MemoryMap filteredMemoryMap; 50 | private MemoryMap compressedMemoryMap; 51 | 52 | // Tree view 53 | private JComboBox memoryMapSelectionBox; 54 | private MemoryMapTree memoryMapTree; 55 | private JPanel memoryTreePanel; 56 | private Border memoryTreeBorder; 57 | 58 | // Picture view 59 | private MemoryMapPicture memoryMapPicture; 60 | private JPanel zoomPanel; 61 | private JButton buttonZoomIn; 62 | private JButton buttonZoomOut; 63 | private JPanel memoryPicturePanel; 64 | private Border memoryPictureBorder; 65 | 66 | // Constructor 67 | public MemoryMapComponent () { 68 | 69 | memoryDetailsListeners = new ArrayList(); 70 | rawMemoryMap = null; 71 | filteredMemoryMap = null; 72 | compressedMemoryMap = null; 73 | 74 | // Create contents 75 | JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); 76 | memoryMapTree = new MemoryMapTree(); 77 | memoryMapSelectionBox = new JComboBox(); 78 | memoryMapSelectionBox.addItem(SELECTION_RAW); 79 | memoryMapSelectionBox.addItem(SELECTION_FILTERED); 80 | memoryMapSelectionBox.addItem(SELECTION_COMPRESSED); 81 | memoryMapSelectionBox.setSelectedIndex(2); 82 | memoryTreePanel = new JPanel(new BorderLayout()); 83 | memoryTreeBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Memory Tree"); 84 | memoryMapPicture = new MemoryMapPicture(); 85 | zoomPanel = new JPanel(new GridLayout(1, 2)); 86 | buttonZoomIn = new JButton("+"); 87 | buttonZoomOut = new JButton("-"); 88 | memoryPicturePanel = new JPanel(new BorderLayout()); 89 | memoryPictureBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Memory Picture"); 90 | 91 | // Add listeners 92 | memoryMapTree.addTreeSelectionListener(this); 93 | memoryMapSelectionBox.addItemListener(this); 94 | buttonZoomIn.addActionListener(this); 95 | buttonZoomOut.addActionListener(this); 96 | 97 | // Bind contents 98 | setLayout(new GridLayout(1, 1)); 99 | add(splitPane); 100 | splitPane.setLeftComponent(memoryTreePanel); 101 | memoryTreePanel.add(memoryMapSelectionBox, BorderLayout.NORTH); 102 | memoryTreePanel.add(new JScrollPane(memoryMapTree), BorderLayout.CENTER); 103 | memoryTreePanel.setBorder(memoryTreeBorder); 104 | splitPane.setRightComponent(memoryPicturePanel); 105 | memoryPicturePanel.add(new JScrollPane(memoryMapPicture), BorderLayout.CENTER); 106 | memoryPicturePanel.add(zoomPanel, BorderLayout.NORTH); 107 | memoryPicturePanel.setBorder(memoryPictureBorder); 108 | zoomPanel.add(buttonZoomIn); 109 | zoomPanel.add(buttonZoomOut); 110 | 111 | // Set preferred sizes 112 | memoryTreePanel.setPreferredSize(new Dimension(300, 700)); 113 | memoryPicturePanel.setPreferredSize(new Dimension(300, 700)); 114 | } 115 | 116 | public void addMemoryDetailsListener (MemoryDetailsListener memoryDetailsListener) { 117 | memoryDetailsListeners.add(memoryDetailsListener); 118 | } 119 | 120 | private void notifyMemoryDetailsListeners (Object object) { 121 | for (int i = 0; i < memoryDetailsListeners.size(); i++) 122 | memoryDetailsListeners.get(i).showDetails(object); 123 | } 124 | 125 | // ItemListener 126 | public void itemStateChanged(ItemEvent e) { 127 | updateTree(); 128 | updatePicture(); 129 | } 130 | 131 | // TreeSelectionListener 132 | public void valueChanged(TreeSelectionEvent e) { 133 | 134 | // Get info of selected node 135 | Object component = memoryMapTree.getLastSelectedPathComponent(); 136 | if (component instanceof DefaultMutableTreeNode) { 137 | 138 | Object nodes[] = ((DefaultMutableTreeNode)component).getPath(); 139 | 140 | for (int i = 0; i < nodes.length; i++) { 141 | Object nodeInfo = ((DefaultMutableTreeNode)nodes[i]).getUserObject(); 142 | 143 | if (nodeInfo instanceof Region) 144 | memoryMapPicture.setSelectedRegion((Region)nodeInfo); 145 | if (nodeInfo instanceof SubRegion) 146 | memoryMapPicture.setSelectedSubRegion((SubRegion)nodeInfo); 147 | if (nodeInfo instanceof RegionData) 148 | memoryMapPicture.setSelectedRegionData((RegionData)nodeInfo); 149 | 150 | if (i == nodes.length - 1) 151 | notifyMemoryDetailsListeners(nodeInfo); 152 | } 153 | } 154 | } 155 | 156 | // ActionListener 157 | public void actionPerformed(ActionEvent e) { 158 | if (e.getSource() == buttonZoomIn) 159 | memoryMapPicture.zoomIn(); 160 | else if (e.getSource() == buttonZoomOut) 161 | memoryMapPicture.zoomOut(); 162 | } 163 | 164 | // MemoryInfoUpdateListener 165 | public void update (MemoryInfoFactory memoryInfoFactory) { 166 | rawMemoryMap = memoryInfoFactory.getRawMemoryMap(); 167 | filteredMemoryMap = memoryInfoFactory.getFilteredMemoryMap(); 168 | compressedMemoryMap = memoryInfoFactory.getCompressedMemoryMap(); 169 | 170 | updateTree(); 171 | updatePicture(); 172 | } 173 | 174 | // Updaters 175 | private void updateTree () { 176 | if (memoryMapSelectionBox.getSelectedItem().equals(SELECTION_RAW)) { 177 | memoryMapTree.setMemoryMap(rawMemoryMap); 178 | } else if (memoryMapSelectionBox.getSelectedItem().equals(SELECTION_FILTERED)) { 179 | memoryMapTree.setMemoryMap(filteredMemoryMap); 180 | } else if (memoryMapSelectionBox.getSelectedItem().equals(SELECTION_COMPRESSED)) { 181 | memoryMapTree.setMemoryMap(compressedMemoryMap); 182 | } 183 | } 184 | 185 | private void updatePicture () { 186 | // Happens automatically by selecting a region 187 | } 188 | } 189 | 190 | class MemoryMapTree extends JTree 191 | { 192 | private static final long serialVersionUID = 1L; 193 | 194 | // Attributes 195 | private DefaultTreeModel memoryMapTreeModel; 196 | 197 | // Constructor 198 | public MemoryMapTree() { 199 | memoryMapTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode("No map loaded...")); 200 | getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); 201 | super.setModel(memoryMapTreeModel); 202 | setRootVisible(true); 203 | } 204 | 205 | // Overriden method that controls the text in the tree 206 | public String convertValueToText (Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { 207 | if (value instanceof DefaultMutableTreeNode) 208 | { 209 | // Get user object 210 | Object info = ((DefaultMutableTreeNode)value).getUserObject(); 211 | 212 | // Change behavior depending on class 213 | if (info instanceof MemoryMap) 214 | return "Memory Map"; 215 | else if (info instanceof Region) 216 | return "Region: " + ((Region)info).getName(); 217 | else if (info instanceof SubRegion) 218 | return "Subregion: " + ((SubRegion)info).getName(); 219 | else if (info instanceof RegionData) 220 | return "Regiondata @ " + "0x" + Long.toHexString(0x100000000L | (((RegionData)info).getAddress() & 0xFFFFFFFF)).substring(1).toUpperCase(); 221 | else 222 | return info.toString(); 223 | } 224 | return value.toString(); 225 | } 226 | 227 | public void setMemoryMap (MemoryMap memoryMap) { 228 | 229 | // Update tree 230 | DefaultMutableTreeNode mapTreeRoot = new DefaultMutableTreeNode(memoryMap); 231 | for (int i = 0; i < memoryMap.getNumberOfRegions(); i++) 232 | { 233 | Region region = memoryMap.getRegion(i); 234 | DefaultMutableTreeNode nodeRegion = new DefaultMutableTreeNode(region); 235 | mapTreeRoot.add(nodeRegion); 236 | 237 | for (int j = 0; j < region.getNumberOfSubRegions(); j++) 238 | { 239 | SubRegion subRegion = region.getSubRegion(j); 240 | DefaultMutableTreeNode nodeSubRegion = new DefaultMutableTreeNode(subRegion); 241 | nodeRegion.add(nodeSubRegion); 242 | 243 | for (int k = 0; k < subRegion.getNumberOfRegionData(); k++) 244 | { 245 | RegionData regionData = subRegion.getRegionData(k); 246 | DefaultMutableTreeNode nodeRegionData = new DefaultMutableTreeNode(regionData); 247 | nodeSubRegion.add(nodeRegionData); 248 | } 249 | } 250 | } 251 | 252 | memoryMapTreeModel.setRoot(mapTreeRoot); 253 | setRootVisible(true); 254 | } 255 | } 256 | 257 | class MemoryMapPicture extends JPanel 258 | { 259 | private static final long serialVersionUID = 1L; 260 | 261 | // Constants 262 | private static final double zoomFactor = 2; 263 | private static final double maxZoomIn = 8; 264 | private static final double minZoomIn = 0.001; 265 | private static final int offsetX = 20; 266 | private static final int offsetY = 20; 267 | private static final int width = 200; 268 | private static final int selectedRegionWidth = 50; 269 | 270 | // Attributes 271 | private Region selectedRegion; 272 | private SubRegion selectedSubRegion; 273 | private RegionData selectedRegionData; 274 | private double scale; 275 | private boolean focus; 276 | 277 | // Constructor 278 | public MemoryMapPicture () { 279 | selectedRegion = null; 280 | selectedSubRegion = null; 281 | selectedRegionData = null; 282 | scale = 0.25; 283 | focus = false; 284 | 285 | setBackground(Color.WHITE); 286 | } 287 | 288 | public void setSelectedRegion (Region region) { 289 | this.selectedRegion = region; 290 | setSelectedSubRegion(region.getSubRegion(0)); 291 | //repaint(); 292 | } 293 | 294 | public void setSelectedSubRegion (SubRegion subRegion) { 295 | this.selectedSubRegion = subRegion; 296 | setSelectedRegionData(subRegion.getRegionData(0)); 297 | //repaint(); 298 | } 299 | 300 | public void setSelectedRegionData (RegionData regionData) { 301 | this.selectedRegionData = regionData; 302 | repaint(); 303 | } 304 | 305 | public void zoomIn () { 306 | scale *= zoomFactor; 307 | if (scale > maxZoomIn) 308 | scale = maxZoomIn; 309 | focus = true; 310 | repaint(); 311 | } 312 | 313 | public void zoomOut () { 314 | scale /= zoomFactor; 315 | if (scale < minZoomIn) 316 | scale = minZoomIn; 317 | focus = true; 318 | repaint(); 319 | } 320 | 321 | public void paint (Graphics g) { 322 | super.paint(g); 323 | 324 | // Check whether there is something to draw 325 | if (selectedRegion == null) 326 | return; 327 | 328 | // Draw all subregions 329 | int focusY = 0; 330 | int maxY = 0; 331 | long baseAddress = selectedRegion.getData().getAddress(); 332 | for (int i = 0; i < selectedRegion.getNumberOfSubRegions(); i++) { 333 | SubRegion subRegion = selectedRegion.getSubRegion(i); 334 | for (int j = 0; j < subRegion.getNumberOfRegionData(); j++) { 335 | RegionData regionData = subRegion.getRegionData(j); 336 | 337 | // Draw regiondata 338 | int y = offsetY + (int)((regionData.getAddress() - baseAddress) * scale); 339 | int height = (int)(regionData.getSize() * scale); 340 | 341 | // Draw selected different 342 | if (subRegion == selectedSubRegion) { 343 | g.setColor(Color.RED); 344 | g.fillRect(offsetX, y, width, height); 345 | g.setColor(Color.BLACK); 346 | } 347 | 348 | g.drawRect(offsetX, y, width, height); 349 | 350 | if (regionData == selectedRegionData) { 351 | focusY = y; 352 | g.setColor(Color.BLUE); 353 | g.drawLine(offsetX, y, offsetX + width + selectedRegionWidth, y); 354 | g.setColor(Color.BLACK); 355 | } 356 | 357 | // Determine maxY 358 | if ((height + y) > maxY) 359 | maxY = height + y; 360 | } 361 | } 362 | 363 | // Resize panel 364 | int preferredWidth = 2 * offsetX + width + selectedRegionWidth; 365 | int preferredHeight = offsetY + maxY; 366 | super.setPreferredSize(new Dimension(preferredWidth, preferredHeight)); 367 | if (focus) { 368 | focus = false; 369 | super.scrollRectToVisible(new Rectangle(0, focusY, 1, (int) (8*scale))); 370 | } 371 | super.revalidate(); 372 | } 373 | } 374 | -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryViewer.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer; 2 | 3 | import java.io.File; 4 | 5 | import javax.swing.JFrame; 6 | import javax.swing.JSplitPane; 7 | 8 | public class MemoryViewer extends JFrame 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | // Attributes 13 | private MemoryViewerMenu memoryViewerMenu; 14 | private MemoryConfigurationAndContentsComponent memoryConfigurationAndContentsComponent; 15 | private MemoryMapComponent memoryMapComponent; 16 | private MemoryDetailsComponent memoryDetailsComponent; 17 | 18 | // Constructor 19 | public MemoryViewer (String fileNameAndPath) { 20 | 21 | // Create contents 22 | memoryViewerMenu = new MemoryViewerMenu(); 23 | memoryConfigurationAndContentsComponent = new MemoryConfigurationAndContentsComponent(); 24 | memoryMapComponent = new MemoryMapComponent(); 25 | memoryDetailsComponent = new MemoryDetailsComponent(); 26 | 27 | // Add listeners 28 | memoryViewerMenu.addMemoryInfoUpdateListener(memoryMapComponent); 29 | memoryViewerMenu.addMemoryInfoUpdateListener(memoryConfigurationAndContentsComponent); 30 | memoryConfigurationAndContentsComponent.addMemoryDetailsListener(memoryDetailsComponent); 31 | memoryMapComponent.addMemoryDetailsListener(memoryDetailsComponent); 32 | 33 | // Bind contents 34 | setJMenuBar(memoryViewerMenu); 35 | JSplitPane memoryInfoPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); 36 | JSplitPane memoryDetailsPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); 37 | memoryInfoPane.setLeftComponent(memoryConfigurationAndContentsComponent); 38 | memoryInfoPane.setRightComponent(memoryMapComponent); 39 | memoryDetailsPane.setLeftComponent(memoryInfoPane); 40 | memoryDetailsPane.setRightComponent(memoryDetailsComponent); 41 | getContentPane().add(memoryDetailsPane); 42 | 43 | // Setup frame 44 | setTitle("Memory Viewer"); 45 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 46 | setLocationRelativeTo(null); 47 | setExtendedState(JFrame.MAXIMIZED_BOTH); 48 | pack(); 49 | setVisible(true); 50 | 51 | // Load file if specified 52 | if (fileNameAndPath != null) { 53 | File file = new File(fileNameAndPath); 54 | memoryViewerMenu.load(file); 55 | } 56 | } 57 | 58 | // Program entry point 59 | public static void main (String[] args) { 60 | 61 | if (args.length > 0) 62 | new MemoryViewer(args[0]); 63 | else 64 | new MemoryViewer(null); 65 | } 66 | } -------------------------------------------------------------------------------- /src/MemoryViewer/MemoryViewerMenu.java: -------------------------------------------------------------------------------- 1 | package MemoryViewer; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | import java.io.File; 6 | import java.util.ArrayList; 7 | 8 | import javax.swing.JFileChooser; 9 | import javax.swing.JMenu; 10 | import javax.swing.JMenuBar; 11 | import javax.swing.JMenuItem; 12 | import javax.swing.filechooser.FileNameExtensionFilter; 13 | 14 | public class MemoryViewerMenu extends JMenuBar implements ActionListener 15 | { 16 | private static final long serialVersionUID = 1L; 17 | 18 | // Attributes 19 | private JMenu menuFile; 20 | private JMenuItem menuItemLoad; 21 | private MemoryInfoFactory memoryInfoFactory; 22 | private ArrayList memoryInfoUpdateListeners; 23 | 24 | // Constructor 25 | public MemoryViewerMenu () { 26 | 27 | // Initialize attributes 28 | memoryInfoFactory = new MemoryInfoFactory(); 29 | memoryInfoUpdateListeners = new ArrayList(); 30 | 31 | // Create contents 32 | menuFile = new JMenu("File"); 33 | menuItemLoad = new JMenuItem("Load"); 34 | 35 | // Add listeners 36 | menuItemLoad.addActionListener(this); 37 | 38 | // Bind menu 39 | add(menuFile); 40 | menuFile.add(menuItemLoad); 41 | } 42 | 43 | // Loader 44 | public void load (File file) 45 | { 46 | // Load the map, configuration and contents 47 | memoryInfoFactory.load(file); 48 | 49 | // Inform listeners of the update 50 | for (int i = 0; i < memoryInfoUpdateListeners.size(); i++) { 51 | memoryInfoUpdateListeners.get(i).update(memoryInfoFactory); 52 | } 53 | } 54 | 55 | // Menu action listener 56 | public void actionPerformed (ActionEvent e) 57 | { 58 | if (e.getSource() == menuItemLoad) { 59 | 60 | // Load a file 61 | FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter("map files (*.map)", "map"); 62 | JFileChooser fileChooser = new JFileChooser(); 63 | fileChooser.setFileFilter(extensionFilter); 64 | if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { 65 | load(fileChooser.getSelectedFile()); 66 | } 67 | } 68 | } 69 | 70 | // Other methods 71 | public void addMemoryInfoUpdateListener (MemoryInfoUpdateListener memoryInfoUpdateListener) { 72 | memoryInfoUpdateListeners.add(memoryInfoUpdateListener); 73 | } 74 | } 75 | --------------------------------------------------------------------------------