dragonmux
8e99e8ec4d
rp: Added some debugging to the SFDP read routine to aid with SFDP failures
2022-08-08 14:43:29 -07:00
dragonmux
298299d85b
rp: Cleaned up some variable naming in the ROM function table reader
2022-08-08 14:43:29 -07:00
dragonmux
9681475ab5
rp: Made use of the SFDP routines to extract the necessary Flash parameters
2022-08-08 14:43:29 -07:00
dragonmux
253d0cc1d9
rp: Entirely rewrote the SPI Flash read routine so we can implement SFDP support
2022-08-08 14:43:29 -07:00
dragonmux
969c7c6c14
rp: Naming cleanup for the memory region base addresses and sizes
2022-08-08 14:43:29 -07:00
dragonmux
ff30b66b3a
rp: Cleaned up the RP register definitions for the SPI Flash and the chip select line control routine
2022-08-08 14:43:29 -07:00
dragonmux
2058725dd8
rp: Cleaned up and rewrote the ROM function table readout code to be more understandable and transparent
...
This saves 20 bytes of Flash
2022-08-08 14:43:29 -07:00
dragonmux
a372cfd787
rp: Fixed the private structure naming and made a typedef for it
2022-08-08 14:43:29 -07:00
dragonmux
11b43a7c66
rp: Refactored the ROM table tags using a helper macro
2022-08-08 14:43:29 -07:00
dragonmux
f2b0d3030c
rp: Fixed the UB _-prefixed naming of the ROM routines
2022-08-08 14:43:29 -07:00
dragonmux
8d772d048b
rp: Cleaned up ROM table function table readout
2022-08-08 14:43:29 -07:00
dragonmux
8382b0aa7d
rp: Magic numbers cleanup using top of file definitions
2022-08-08 14:43:29 -07:00
dragonmux
0077d31be3
rp: Make the function naming scheme uniform
2022-07-31 16:23:31 -07:00
dragonmux
6288d5884d
rp: Fixed another clang-tidy warning
2022-07-31 16:23:31 -07:00
dragonmux
7266e3cf54
rp: More code re-ordering to make the order of definitions make more sense
2022-07-31 16:23:31 -07:00
dragonmux
982d1ac847
rp: atoi() -> strtoul() to fix the clang-tidy warning and improve robustness and correctness
2022-07-31 16:23:31 -07:00
dragonmux
efb2e99408
rp: re-grouped the target-specific commands to the bottom of the implementation
2022-07-31 16:23:31 -07:00
dragonmux
ae982cae6b
rp: Begun re-ordering the code to make it more like other targets
2022-07-31 16:23:31 -07:00
dragonmux
9015013195
rp: static correctness for several of the RP2040 routines
2022-07-31 16:23:31 -07:00
dragonmux
f429898adb
rp: Removed rp_detach as the function serves no purpose
2022-07-31 16:23:31 -07:00
Rafael Silva
8b5206fb8d
target: add weak aliasing to allow disabling targets
...
Signed-off-by: Rafael Silva <perigoso@riseup.net>
2022-07-26 05:08:10 +01:00
dragonmux
c530bd077b
misc: Switched to using C11
2022-07-18 20:59:15 -07:00
dragonmux
d64992ade8
rp: Cleanup in how we define some of the Flash constants
2022-07-13 19:34:57 -07:00
dragonmux
e9b75ba4bc
rp: Switched to the unified mass erase command and added progress dots to stop GDB timing out
2022-07-13 19:34:57 -07:00
Jonathan Giles
780ee7a2a8
Fix build error and logic ...
2022-06-28 06:31:16 -04:00
dragonmux
aa9c80b37d
misc: Formatting consistency
2022-06-26 16:51:58 -07:00
dragonmux
b226c53d13
misc: Renamed CORTEXM_TOPT_INHIBIT_NRST to clarify usage and align naming
2022-06-26 16:51:58 -07:00
James Turton
e702afad69
rp: Clean up code a little bit
2022-06-24 20:44:00 -04:00
James Turton
e67cb9f43c
rp: Update rp_get_flash_length algorithm
...
Try to look for repeating sectors before reverting to reading the
JEDEC ID of the flash chip. This way we don't interrupt the flash
execution if a valid program is running, but can detect the flash
size if the flash memory has been erased.
2022-06-24 20:44:00 -04:00
James Turton
f2cb13cf36
rp: Add rp_attach and rp_detach callbacks
...
Query JEDEC ID of flash chip on attach to be able to decode flash
chip size.
2022-06-24 20:44:00 -04:00
James Turton
354e37fbad
rp: Tidy up some other things
2022-06-24 20:44:00 -04:00
James Turton
ce273889fc
rp: Refector rp_flash_write
...
Fix typo in debug message
2022-06-24 20:44:00 -04:00
James Turton
f4261c465e
rp: Refactor rp_flash_erase
...
Always align erase length to 4k sector size.
Check that start address and length are actually inside the flash.
2022-06-24 20:44:00 -04:00
James Turton
af48a343a8
rp: Add description for SPI flash commands
2022-06-11 11:54:34 -04:00
James Turton
b43b9a6545
rp: Add erase_sector to command list
...
The command can be used either by specifying the length only, or
the start address and the length like so:
monitor erase_sector <length>
monitor erase_sector <start_addr> <length>
If no start address is specified, it will begin erasing from the
start of the flash sector.
2022-06-11 11:54:34 -04:00
James Turton
53672f1fc3
rp: Remove CHIP_ERASE command from rp_flash_erase
...
There seems to be a bug in the bootrom for the rp2040 which means
that the chip erase command is not accepted. This is because the
CS pin must be released (set high) directly after sending the chip
erase command (0x60 or 0xC7) (see Winbond W25Q128JV datasheet for
details). Instead the bootrom sends the address after the command,
thus the SPI flash silently ignores the command. Instead, we must
erase each 64KB block one at a time, but thankfull the bootrom
handles this correctly for us.
2022-06-11 11:54:34 -04:00
James Turton
b1694dfab9
rp: Always use maximum flash size (16MB) when defining flash region
...
There are some cases when the this old method for finding the flash
size will fail, such as if the flash chip has been erased with 0xFF
bytes (rather than blank 0x00 bytes). As this is unreliable,
setting the wrong flash size could cause problems when trying to
inspect memory regions which appear to be out of range.
2022-06-11 11:54:34 -04:00
James Turton
203c5149e7
rp: Add CORTEXM_TOPT_INHIBIT_SRST to target_options
2022-06-11 11:54:34 -04:00
Dag Ågren
f6edb54395
Fix RP2040 memory sizes.
2022-06-01 11:41:58 -04:00
Uwe Bonnes
9ebc44bcea
Make more functions static.
2021-09-22 15:16:20 +02:00
Uwe Bonnes
517d5b5b31
rp: Show spinner only when called from monitor command.
2021-05-16 11:26:14 +02:00
James Turton
0ab10fee0b
rp: Increase timeout for flash_range_program
...
If the RP2040 is using the ring oscilator (ROSC) rather than the crystal
oscilator (XOSC) then flashing program will take much longer. As the XOSC is not
enabled at boot we should not assume it will be enabled before the debugger is
connected (or indeed at all), thus should use the longer timeout during load
commands.
2021-05-16 11:26:14 +02:00
James Turton
ff30259354
rp: Add more debug logging during flash
2021-05-16 11:26:14 +02:00
James Turton
e453740aca
rp: Increase spinner timeout to 500ms
...
Increasing spinner timeout to 500 means `tc_printf` is not called during
the `_flash_range_erase`. This is important as `_flash_range_erase` is
used when loading. This fixes the issue:
https://github.com/blacksphere/blackmagic/issues/875
Also adding spinner timeout counter to reduce bus traffic.
2021-05-16 11:26:14 +02:00
James Turton
67c9003522
rp: Flush cache after erase and write
...
The RP2040 datasheet suggests that _flash_flush_cache and _flash_enter_cmd_xip
should be called after erasing and writing to flash.
2021-05-16 11:26:14 +02:00
James Turton
f880734050
Fix compiling for native probe
2021-05-16 11:26:14 +02:00
Uwe Bonnes
1b26ff560d
rp.c: Add reset_usb_boot as monitor command
2021-04-24 14:48:58 +02:00
Uwe Bonnes
52bffa70cf
rp: Handle flash.
...
- Beware, after reset, only a valid flash payload get mapped to XIP!
Only 0 is read from flash when flash image is not valid
2021-04-21 21:55:03 +02:00
Uwe Bonnes
fa5e69e3be
RP 2040: Special handling for rescue DP
...
As the rescue DP provided no AP, trigger the reset with attach().
However attach will indicate failure also reset/halt has succeeded.
2021-04-21 21:50:38 +02:00
Uwe Bonnes
23f942ac8c
Raspberry RP2040: Recognize. No flash handling yet.
2021-04-21 21:50:35 +02:00