Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
96e3fbd
apollo3: Normalised the code organisation
dragonmux Aug 26, 2025
fd11f43
at32f43x: Normalised the code organisation
dragonmux Aug 26, 2025
edf5cf9
efm32: Fixed the `target` and `flash` nomenclature
dragonmux Aug 26, 2025
3ef4ea6
efm32: Fixed a padding issue in the efm32_devices array
dragonmux Aug 26, 2025
5fc92ad
efm32: Compressed the temp grades text a little better
dragonmux Aug 26, 2025
b5b4c7c
efm32: Cleaned up the way the search loops for the temp grade and pac…
dragonmux Aug 26, 2025
5d804bb
efm32: Standardised the comment style used
dragonmux Aug 26, 2025
d59aa94
efm32: Switch the loop style for efm32_flash_erase() from `while` to …
dragonmux Aug 26, 2025
96bb317
efm32: Modernise efm32_flash_erase() to use the modern Flash API guar…
dragonmux Aug 26, 2025
9b35f87
kinetis: Fixed the `target` and `flash` nomenclature
dragonmux Aug 27, 2025
1d084a6
kinetis: Normalised the code organisation
dragonmux Aug 27, 2025
08d8c09
kinetis: Switch the loop style for kinetis_flash_cmd_erase() from `wh…
dragonmux Aug 27, 2025
1b9a34a
efm32: Modernise kinetis_flash_cmd_erase() to use the modern Flash AP…
dragonmux Aug 27, 2025
6429ce7
kinetis: Switch the loop style for kinetis_flash_cmd_write() from `wh…
dragonmux Aug 27, 2025
b73a035
kinetis: Further code style cleanup and types improvements
dragonmux Aug 27, 2025
f1b167c
lmi: Fixed the macro prefixing
dragonmux Aug 27, 2025
f36629a
lmi: Modernised the lmi_flash_erase() loop a bit
dragonmux Aug 27, 2025
4a613d3
stm32h5: Fixed a missign `default` statement in stm32h5_probe()'s dis…
dragonmux Aug 27, 2025
f684831
ch579: Normalised the comment style
dragonmux Aug 28, 2025
8f94219
ch32vx: Fixed some DEBUG_INFO format specifier issues, and a couple o…
dragonmux Aug 28, 2025
72e9b00
ch32f1: Fixed the macro prefixing and nomenclature
dragonmux Aug 29, 2025
c875dce
efm32: Normalised the code organisation
dragonmux Aug 31, 2025
b549bde
lmi: Normalised the code organisation
dragonmux Aug 31, 2025
8957fea
lpc15xx: Normalised the code organisation
dragonmux Aug 31, 2025
54111a5
lpc15xx: Fixed the `target` nomenclature
dragonmux Aug 31, 2025
6d2db07
lpc546xx: Fixed the `target` and `flash` nomenclature
dragonmux Aug 31, 2025
9ea1b72
lpc546xx: Cleaned up in the reset command implementation using a mode…
dragonmux Aug 31, 2025
ef2e90d
lpc546xx: Normalised the code organisation
dragonmux Aug 31, 2025
00a0208
lpc55xx: Fixed some clang-tidy lints
dragonmux Aug 31, 2025
7d67346
lpc43xx: Fixed the `target` and `flash` nomenclature
dragonmux Aug 31, 2025
fd509a7
lpc43xx: Normalised the code organisation
dragonmux Aug 31, 2025
2692ec0
lpc40xx: Swizzled some logic in the probe routine for more consistent…
dragonmux Sep 7, 2025
ac69198
lpc17xx: Swizzled some logic in the probe routine for more consistent…
dragonmux Sep 7, 2025
c900f40
lpc55xx: Normalised the code organisation a bit
dragonmux Sep 7, 2025
6795d17
msp432p4: Fixed the `target` and `flash` nomenclature
dragonmux Sep 7, 2025
14139d9
msp432p4: Fixed some issues with the logging used
dragonmux Sep 7, 2025
cf497ee
msp432p4: Switched the loop style for msp432_flash_erase() from `whil…
dragonmux Sep 7, 2025
5f5b2ef
msp432p4: Modernised msp432_flash_erase() to use the modern Flash API…
dragonmux Sep 7, 2025
3a62d7c
msp432p4: `const` improvements and further nomenclature fixes for `ta…
dragonmux Sep 8, 2025
9b65728
mspm0: Normalised the code organisation a bit
dragonmux Sep 8, 2025
ccc7ed2
nrf51: Fixed the `target` and `flash` nomenclature
dragonmux Sep 8, 2025
6b9948a
nrf51: Normalised the code organisation a bit
dragonmux Sep 8, 2025
cb2c67d
nrf54l: Normalised the code organisation a bit
dragonmux Sep 8, 2025
1cc4f56
nrf91: Normalised the code organisation a bit
dragonmux Sep 8, 2025
4a53527
nxpke04: Fixed the `target` and `flash` nomenclature
dragonmux Sep 8, 2025
b1a56c1
nxpke04: Normalised the code organisation a bit
dragonmux Sep 8, 2025
2266c94
puya: Fixed some clang-tidy warnings and a code organisation oops
dragonmux Sep 8, 2025
367ea2d
nrf54l: Added missing copyright notice and license per comments in #1316
dragonmux Sep 8, 2025
d679ca6
nrf91: Added missing copyright notice and license per comments in #1316
dragonmux Sep 8, 2025
3e48511
nrf51: Fixed up the comment style for top-of-file
dragonmux Sep 8, 2025
26a1d1d
nrf54l: Added the top-of-file comment block which was missing
dragonmux Sep 8, 2025
987e484
nrf91: Added the top-of-file comment block which was missing
dragonmux Sep 8, 2025
ee78dc1
s32k3xx: Fixed several code organisation issues and clang-tidy warnings
dragonmux Sep 9, 2025
5b546b7
sam3x: Fixed several clang-tidy warnings and the top-of-file comment …
dragonmux Sep 9, 2025
2d25bde
sam4l: Fixed up the comment style for top-of-file
dragonmux Sep 9, 2025
5e579de
sam4l: Fixed the `target` and `flash` nomenclature
dragonmux Sep 9, 2025
798b725
sam4l: Fixed the macro prefixing and nomenclature
dragonmux Sep 10, 2025
50c966a
samd: Fixed the `target` and `flash` nomenclature
dragonmux Sep 10, 2025
86b9fb9
samd: Normalised the code organisation a bit
dragonmux Sep 10, 2025
b5eb404
samd: Fixed several clang-tidy warnings
dragonmux Sep 10, 2025
d000ecb
stm32f1: Fixed a couple of clang-tidy warnings
dragonmux Sep 10, 2025
bb92268
stm32f1: Fixed up the comment style for top-of-file
dragonmux Sep 11, 2025
b1d44de
stm32f1: Fixed the macro prefixing and nomenclature
dragonmux Sep 11, 2025
b068c09
stm32h5: Fixed the macro nomenclature
dragonmux Sep 11, 2025
2351e77
stm32f4: Fixed the macro prefixing and nomenclature
dragonmux Sep 13, 2025
f88bbc0
stm32f4: Normalised the code organisation a bit
dragonmux Sep 13, 2025
f1af0db
stm32g0: Fixed the macro prefixing and nomenclature
dragonmux Sep 13, 2025
57a7722
stm32g0: Fixed a clang-tidy lint about a missing `default` case
dragonmux Sep 14, 2025
e530d89
stm32h7: Fixed the macro prefixing
dragonmux Sep 14, 2025
2b62ce0
stm32l0: Fixed some clang-tidy lints about missing `default` cases
dragonmux Sep 14, 2025
4d9bcd1
stm32l4: Normalised the code organisation a bit
dragonmux Sep 14, 2025
00eba64
stm32l4: Fixed the macro prefixing and nomenclature
dragonmux Sep 14, 2025
ede1384
stm32l4: Fixed up the comment style for top-of-file
dragonmux Sep 14, 2025
7ccc076
stm32l4: Fixed some more macro prefixing and nomenclature
dragonmux Sep 18, 2025
1990447
stm32l4: Fixed some prefixing and nomenclature for the FPEC regs maps
dragonmux Sep 18, 2025
4cbd27f
target: Fixed a couple of clang-tidy warnings
dragonmux Sep 18, 2025
fd5ecdb
target_flash: Added back in a diagnostic for the Flash write calls to…
dragonmux Sep 18, 2025
245683d
adiv5_swd: Fixed a consistency issue in one of the mode switch diagno…
dragonmux Sep 21, 2025
228109d
at32f43x: Removed an unnecessary check that the `len` parameter to `a…
dragonmux Sep 21, 2025
cc51a08
at32f43x: Removed some now unnessary diagnostics from `at32f43_flash_…
dragonmux Sep 21, 2025
a45b1e9
at32f43x: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
25d8585
stm32l4: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
216aadb
stm32l0: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
ca196af
stm32h7: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
957679a
stm32g0: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
86830d6
stm32g0: Code organisation and nomenclature improvements for the opti…
dragonmux Oct 1, 2025
5cb2a94
stm32g0: Modernised and simplified the erase logic in stm32g0_flash_e…
dragonmux Oct 1, 2025
92d54ac
stm32f4: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
fd8c690
stm32f4: Modernised and simplified the erase logic in stm32f4_flash_e…
dragonmux Oct 1, 2025
d829f0a
stm32f1: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
680fef8
stm32f1: Fixed the incorrect address mask issue from #1826 in the `mm…
dragonmux Oct 1, 2025
3b84144
sam4l: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
f28113c
sam4l: Fixed the style of one of the comments in `sam4l_flash_write()`
dragonmux Oct 1, 2025
d5cca86
sam4l: Removed unnecessary diagnostics (which were also at the wrong …
dragonmux Oct 1, 2025
0c28aab
sam4l: Target Flash API guarantees that `len` will be `blocksize` for…
dragonmux Oct 1, 2025
530af6c
sam3x: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
b82396e
s32k3xx: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
b5d90bc
s32k3xx: Fixed up the comment style for top-of-file
dragonmux Oct 1, 2025
7756158
rp2040: Fixed up the comment style for top-of-file
dragonmux Oct 1, 2025
56c1082
samd: Fixed the `target` nomenclature in `rp_cmd_reset_usb_boot()`
dragonmux Oct 1, 2025
25b8137
rp2040: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
038fb11
rp2040: Fixed the macro prefixing and nomenclature
dragonmux Oct 1, 2025
04c4846
rp2040: More cleanup for `const`-correctness and nomenclature
dragonmux Oct 1, 2025
107f248
puya: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
3dd0dcd
nxpke04: `const`-correctness for the function signatures
dragonmux Oct 1, 2025
3c5737e
stm32g0: Make use of the target structure's `unsafe_enabled` member i…
dragonmux Oct 1, 2025
2ac71ef
nxpke04: `sector_erase` duplicates `erase_range` command, deprecate i…
dragonmux Oct 2, 2025
bfc82ad
nrf91: Modernised and simplified the erase logic in `nrf91_flash_eras…
dragonmux Oct 2, 2025
32b6a2f
nrf91: `const`-correctness for the function signatures
dragonmux Oct 2, 2025
9cd1f61
nrf54l: `const`-correctness for the function signatures
dragonmux Oct 2, 2025
5d4c420
nrf51: `const`-correctness for the function signatures
dragonmux Oct 2, 2025
04c47a1
nrf51: Modernised and simplified the erase logic in `nrf51_flash_eras…
dragonmux Oct 2, 2025
97cb621
nrf51: Code organisation improvements for the recovery AP code
dragonmux Oct 2, 2025
3059f8e
mspm0: `const`-correctness for the function signatures
dragonmux Oct 2, 2025
de1d930
mspm0: Removed unnecessary diagnostics (target Flash API already prov…
dragonmux Oct 2, 2025
30e5eee
msp432p4: Normalised the code organisation a bit
dragonmux Oct 2, 2025
fae5d2d
msp432p4: `const`-correctness for the function signatures
dragonmux Oct 2, 2025
3f3d07b
msp432p4: Removed unnecessary diagnostics (target Flash API already p…
dragonmux Oct 2, 2025
276dc1b
msp432p4: Fixed up the comment style for top-of-file
dragonmux Oct 3, 2025
1f3e558
lpc546xx: `const`-correctness for the function signatures
dragonmux Oct 3, 2025
503fee9
lpc546xx: Remove the deprecated `erase_sector` command
dragonmux Oct 3, 2025
8ff8dc0
lpc55xx: Fixed up the comment style for top-of-file
dragonmux Oct 3, 2025
d6a0814
lpc55xx: Fixed various type usage and missing `const` in the part inf…
dragonmux Oct 4, 2025
62f05d7
lpc55xx: `const`-correctness for the function signatures
dragonmux Oct 4, 2025
41ca92f
lpc55xx: Split the `lpc55xx_enter_flash_mode()` mini binary into two …
dragonmux Oct 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/target/lpc55xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static target_addr_t lpc55xx_get_flash_erase_address(target_s *target)
return 0x1300413bU; // UNTESTED: found in SDK, not referenced in UM

target_addr_t flash_table_address = lpc55xx_get_flash_table_address(target, bootloader_tree_address);
return target_mem32_read32(target, flash_table_address + 2 * sizeof(uint32_t));
return target_mem32_read32(target, flash_table_address + (2U * sizeof(uint32_t)));
}

static target_addr_t lpc55xx_get_flash_program_address(target_s *target)
Expand All @@ -242,7 +242,7 @@ static target_addr_t lpc55xx_get_flash_program_address(target_s *target)
return 0x1300419dU; // UNTESTED: found in SDK, not referenced in UM

target_addr_t flash_table_address = lpc55xx_get_flash_table_address(target, bootloader_tree_address);
return target_mem32_read32(target, flash_table_address + 3 * sizeof(uint32_t));
return target_mem32_read32(target, flash_table_address + (3U * sizeof(uint32_t)));
}

static target_addr_t lpc55xx_get_ffr_init_address(target_s *target)
Expand All @@ -251,8 +251,8 @@ static target_addr_t lpc55xx_get_ffr_init_address(target_s *target)
target_addr_t flash_table_address = lpc55xx_get_flash_table_address(target, bootloader_tree_address);

if (lpc55xx_get_rom_api_version(target, bootloader_tree_address) == 0)
return target_mem32_read32(target, flash_table_address + 7 * sizeof(uint32_t));
return target_mem32_read32(target, flash_table_address + 10 * sizeof(uint32_t));
return target_mem32_read32(target, flash_table_address + (7U * sizeof(uint32_t)));
return target_mem32_read32(target, flash_table_address + (10U * sizeof(uint32_t)));
}

static target_addr_t lpc55xx_get_ffr_get_uuid_address(target_s *target)
Expand All @@ -261,8 +261,8 @@ static target_addr_t lpc55xx_get_ffr_get_uuid_address(target_s *target)
target_addr_t flash_table_address = lpc55xx_get_flash_table_address(target, bootloader_tree_address);

if (lpc55xx_get_rom_api_version(target, bootloader_tree_address) == 0)
return target_mem32_read32(target, flash_table_address + 10 * sizeof(uint32_t));
return target_mem32_read32(target, flash_table_address + 13 * sizeof(uint32_t));
return target_mem32_read32(target, flash_table_address + (10U * sizeof(uint32_t)));
return target_mem32_read32(target, flash_table_address + (13U * sizeof(uint32_t)));
}

static lpc55xx_iap_status_e iap_call_raw(target_s *target, lpc55xx_iap_cmd_e cmd, uint32_t r1, uint32_t r2, uint32_t r3)
Expand Down Expand Up @@ -420,14 +420,12 @@ static bool lpc55xx_enter_flash_mode(target_s *target)
// put it back into a known state. Unfortunately target_reset hangs for this
// target and I'm not sure why, so the below is a viable workaround for now.

const uint32_t reg_pc_value = LPC55xx_CODE_PATCH_ADDRESS | 1;
const uint32_t reg_pc_value = LPC55xx_CODE_PATCH_ADDRESS | 1U;

// Execute a small binary patch which just disables interrupts and then hits
// a breakpoint, to allow the flash IAP calls to run undisturbed. This patch
// consists of the instructions CPSID I; BKPT; in ARM Thumb encoding.
const uint32_t CODE_PATCH = 0xbe00b672U;

target_mem32_write32(target, LPC55xx_CODE_PATCH_ADDRESS, CODE_PATCH);
target_mem32_write32(target, LPC55xx_CODE_PATCH_ADDRESS, 0xbe00b672U);
target_reg_write(target, CORTEX_REG_PC, &reg_pc_value, sizeof(uint32_t));

target_halt_resume(target, false);
Expand Down