Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6634415
Move the spi vendor list from Esp.h to its own header in eboot.
ChocolateFrogsNuts Nov 8, 2019
46578fe
Fix ifdef issue with spi_vendors.h
ChocolateFrogsNuts Nov 8, 2019
d49a4ec
Add initFlashQuirks() for any chip specific flash initialization.
ChocolateFrogsNuts Nov 8, 2019
55c23cf
Merge branch 'master' into xmc_flash
ChocolateFrogsNuts Nov 8, 2019
fc5013f
namespace experimental for initFlashQuirks()
ChocolateFrogsNuts Nov 9, 2019
f6e2559
Merge branch 'master' into xmc_flash
devyte Nov 14, 2019
c63da34
Merge branch 'master' into xmc_flash
devyte Nov 15, 2019
b4e5e78
Merge branch 'master' into xmc_flash
devyte Nov 19, 2019
4dc15ea
Slow down flash access during eboot firmware copy
ChocolateFrogsNuts Nov 21, 2019
cb3ab4a
Merge branch 'master' into xmc_flash
ChocolateFrogsNuts Nov 21, 2019
7491779
Merge branch 'master' into xmc_flash
ChocolateFrogsNuts Nov 22, 2019
61c0a33
Slow down flash access during eboot firmware copy on XMC chips
ChocolateFrogsNuts Nov 22, 2019
3229f3d
Merge branch 'master' into xmc_flash
ChocolateFrogsNuts Nov 22, 2019
814bb0d
Merge branch 'xmc_flash' of https://github.com/ChocolateFrogsNuts/Ard…
ChocolateFrogsNuts Nov 22, 2019
da39eb9
Merge branch 'master' into xmc_flash
earlephilhower Dec 21, 2019
ebb1bce
Merge branch 'master' into xmc_flash
devyte Apr 20, 2020
3ff5ec5
Commit eboot.elf
ChocolateFrogsNuts Apr 23, 2020
be68c14
Merge branch 'master' into xmc_flash
ChocolateFrogsNuts Apr 23, 2020
a19ea69
Commit eboot.elf
ChocolateFrogsNuts Apr 23, 2020
aa4a711
Merge branch 'master' into xmc_flash
ChocolateFrogsNuts Apr 23, 2020
7dd4738
Merge branch 'xmc_flash' of https://github.com/ChocolateFrogsNuts/Ard…
ChocolateFrogsNuts Apr 23, 2020
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Slow down flash access during eboot firmware copy on XMC chips
Part 2 - Identify the chip type. Note: there may still be issues with the access speed change. This is very much experimental.
  • Loading branch information
ChocolateFrogsNuts committed Nov 22, 2019
commit 61c0a3304bbf8ece01fe56f62af00826420560db
32 changes: 26 additions & 6 deletions bootloaders/eboot/eboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,28 @@ int copy_raw(const uint32_t src_addr,
return 0;
}

#define XMC_SUPPORT
#ifdef XMC_SUPPORT
// Define a few SPI0 registers we need access to
#define ESP8266_REG(addr) *((volatile uint32_t *)(0x60000000+(addr)))
#define SPI0CMD ESP8266_REG(0x200)
#define SPI0CLK ESP8266_REG(0x218)
#define SPI0C ESP8266_REG(0x208)
#define SPI0W0 ESP8266_REG(0x240)

#define SPICMDRDID (1 << 28)

/* spi_flash_get_id()
Returns the flash chip ID - same as the SDK function.
We need our own version as the SDK isn't available here.
*/
uint32_t __attribute__((noinline)) spi_flash_get_id() {
SPI0W0=0;
SPI0CMD=SPICMDRDID;
while (SPI0CMD) {}
return SPI0W0;
}
#endif // XMC_SUPPORT

void main()
{
Expand All @@ -148,15 +169,12 @@ void main()
if (cmd.action == ACTION_COPY_RAW) {
ets_putc('c'); ets_putc('p'); ets_putc(':');

#define ESP8266_REG(addr) *((volatile uint32_t *)(0x60000000+(addr)))
#define SPI0CLK ESP8266_REG(0x218)
#define SPI0C ESP8266_REG(0x208)

#ifdef XMC_SUPPORT
// save the flash access speed registers
uint32_t spi0clk = SPI0CLK;
uint32_t spi0c = SPI0C;

uint32_t vendor = 0;//spi_flash_get_id() & 0x000000ff;
uint32_t vendor = spi_flash_get_id() & 0x000000ff;
if (vendor == SPI_FLASH_VENDOR_XMC) {
uint32_t flashinfo=0;
if (SPIRead(0, &flashinfo, 4)) {
Expand All @@ -182,14 +200,16 @@ void main()
}
}
}
#endif // XMC_SUPPORT
ets_wdt_disable();
res = copy_raw(cmd.args[0], cmd.args[1], cmd.args[2]);
ets_wdt_enable();

#ifdef XMC_SUPPORT
// restore the saved flash access speed registers
SPI0CLK = spi0clk;
SPI0C = spi0c;

#endif
ets_putc('0'+res); ets_putc('\n');
if (res == 0) {
cmd.action = ACTION_LOAD_APP;
Expand Down