Commit Graph

710 Commits

Author SHA1 Message Date
Mikaela Szekely c136b919cd target/cortex: dynamically generate tdesc strings to save code size
This commit removes the previous tdesc_cortex_a, tdesc_cortex_m, and
tdesc_cortex_mf XML string literals used for target description to GDB,
now instead programmatically generating them at runtime to significantly
deduplicate the characters that get embedded into the binary.

Output of ld's --print-memory-usage during final link before:
Memory region         Used Size  Region Size  %age Used
             rom:      116388 B       128 KB     88.80%
             ram:        3348 B        20 KB     16.35%

Output of ld's --print-memory-usage during final link now:
Memory region         Used Size  Region Size  %age Used
             rom:      113032 B       128 KB     86.24%
             ram:        3376 B        20 KB     16.48%

So all in all this saves 3356 bytes of flash.

Note: the exact size saved when compiled on your machine may differ, as
the size of the build seems at least partially non-deterministic.
We've gotten slightly different sizes (within 15 bytes of each other)
at different times, with the only differences being things like which
files were rebuilt in an incremental rebuild, or the order object files
were given to the linker command line. The numbers given above were the
numbers we got when testing the final builds from scratch, but all the
sizes we got were extremely similar to the sizes listed above.
2022-08-25 18:29:57 -04:00
Rafael Silva 42145f708b target/stm32l0: macro cleanup 2022-08-25 18:10:41 -04:00
Rafael Silva 085dcb7bc9 target/stm: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva 67c9f3f6e2 target/sam: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva 44f7984c58 target/rp: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva ac6aaaeab0 target/nxpke04: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva 220293abc6 target/nrf51: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva 232b6dd376 target/msp432: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva f0c955432b target/lpc: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva 50057d3f55 target/lmi: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva b78818b9ee target/kinetis: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva a6e5b18707 target/efm32: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva cf28b352a7 target/ch32f1: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva e968fc956c target_flash: flash read write return bool 2022-08-25 18:10:41 -04:00
Rafael Silva deb6198921 target_flash: swap while for forloop in buffered flush 2022-08-24 16:03:40 -04:00
Rafael Silva 1a1f4b76ff target_flash: change return types to bool 2022-08-24 16:03:40 -04:00
Rafael Silva aec7460426 target_flash: use new variable for buf size
in cases where blocksize is very large, the allocation may fail due to its size, allow specifying smaller buffer sizes
2022-08-24 16:03:40 -04:00
Rafael Silva be4b07f5ef target_flash: optimize flash prepare/done calls on erase 2022-08-24 16:03:40 -04:00
Rafael Silva 7f25846d36 target_flash: rework buffered writes
ensures aligned writes (aligned to ->writesize)
allows writes to flash smaller than buffer size
deallocate buffer only when done flashing
ensure flashing when writing intermittent blocks of data
new "prepare -> write -> done" function call flow
2022-08-24 16:03:40 -04:00
Rafael Silva 44a028344a target_flash: add prepare routine and extra return checks 2022-08-24 16:03:40 -04:00
Rafael Silva e72edc0579 target_flash: abstract target flash mode/flash preparation 2022-08-24 16:03:40 -04:00
Rafael Silva 520be57e3d target: split target flash functions into seperate file 2022-08-24 16:03:40 -04:00
Rafael Silva 3d3dd21d48 target: ensure aligned erases 2022-08-24 16:03:40 -04:00
Rafael Silva 89a5c2a8a2 target: target_addr type name cleanup 2022-08-24 16:03:40 -04:00
Rafael Silva 21922676f9 target: target_flash type cleanup 2022-08-24 16:03:40 -04:00
Piotr Esden-Tempski 31adb2f94d misc: Cleanup include guards.
Using underscore prefixes is not allowed for include guards as all
defines starting with underscore are reserved. At the same time made
file ends and spacing and style of include guards consistent in all
headers.

The new style of include guards also includes the directory of the
include file relative to `src` directory to prevent potential future
issues where we might end up with a name clash across directories.
2022-08-23 15:06:21 -04:00
Piotr Esden-Tempski 5cc2ff0f3a ch32f1: Correct the debug output format string. 2022-08-22 17:17:44 -04:00
dragonmux 1a7af52edc usb_serial: Fixed up the nomenclature for the USB serial interfaces 2022-08-22 12:59:24 -07:00
dragonmux 3af03c0778 usb_serial: Renamed usbuart_send_stdout() -> debug_uart_send_stdout() 2022-08-22 12:59:24 -07:00
Jonathan Giles 9570b7d21e ch32f1: Differentiate CH32F103 from CKS32F103 and APM32F103 based on REV ID (upper 16 bits of DBGMCU_IDCODE) 2022-08-22 12:48:48 -07:00
dragonmux 79575cc8a9 adiv5: Attempt to handle JTAG DPv0 devices 2022-08-18 18:58:29 -07:00
dragonmux b795cb7ef4 samd: Added an errata workaround for the SAMD11 DFLL48M which can have issues if left unrequested before configuration. 2022-08-18 18:52:00 -07:00
dragonmux 663f2a329a samd: Cleanup and stylistic fixes 2022-08-18 18:52:00 -07:00
dragonmux 8cf1d2f09c target: Added target clock tristating to the target attach and detach functions 2022-08-15 22:16:15 -07:00
dragonmux d4d6218234 stm32g0: Refactored the wait code in the flash write routine 2022-08-15 22:16:15 -07:00
dragonmux d6c1d8a1cc stm32g0: Made the flash write routine a little more understandable 2022-08-15 22:16:15 -07:00
dragonmux 23cf81eb55 stm32g0: Begun cleaning up the flash write routine 2022-08-15 22:16:15 -07:00
dragonmux 486fb6504c stm32g0: Cleaned up stm32g0_flash_lock 2022-08-15 22:16:15 -07:00
dragonmux f554fbd831 stm32g0: Refactored out the cleanup step for the flash routines 2022-08-15 22:16:15 -07:00
dragonmux de909d96f0 stm32g0: Removed some checks from the erase function which can never fire 2022-08-15 22:16:15 -07:00
dragonmux 90fc89fd63 stm32g0: Further naming and structural cleanup in stm32g0_flash_erase 2022-08-15 22:16:15 -07:00
dragonmux f4d8022437 stm32g0: Refactored out the busy wait code into a small function,
This netted a 36 byte code size reduction
2022-08-15 22:16:15 -07:00
dragonmux 60af35b06c stm32g0: Begun sorting out the erase routine mess 2022-08-15 22:16:15 -07:00
dragonmux f859368a97 stm32g0: Fixed the structure naming and typedef'd them 2022-08-15 22:16:15 -07:00
dragonmux 04b86f6eea stm32g0: Cleaned up the STM32G0B_C memory map setup slightly 2022-08-15 22:16:15 -07:00
dragonmux c500e720e3 stm32g0: Removed some more unnecessary casts 2022-08-15 22:16:15 -07:00
dragonmux 43afb5207a stm32g0: Run clang-format through much of the code 2022-08-15 22:16:15 -07:00
dragonmux ba7c6a3048 stm32g0: Cleaned up the flash function definitions 2022-08-15 22:16:15 -07:00
dragonmux 1aa1a3598a stm32g0: Removed some needless casts from the command list build 2022-08-15 22:16:15 -07:00
dragonmux 6b5c492bc7 adiv5_swdp: Implemented clock tristating for adiv5_swdp_scan 2022-08-15 22:16:15 -07:00