Skip to content

Instantly share code, notes, and snippets.

@themadinventor
Created April 17, 2015 08:38
Show Gist options
  • Select an option

  • Save themadinventor/e5b18f252c73b2fa130c to your computer and use it in GitHub Desktop.

Select an option

Save themadinventor/e5b18f252c73b2fa130c to your computer and use it in GitHub Desktop.
sflash stub for esptool
/*
* sflash_stub (c) 2015, Fredrik Ahlberg <fredrik@z80.se>
* Released under the GPLv2.
*/
.literal .P_offset, 0xdeadbeef
.literal .P_size, 0xcafebabe
.literal .P_count, 0xabad1dea
.literal .send_packet, 0x40003c80
.literal .SPIRead, 0x40004b1c
.literal .buffer, 0x3ffe8000
.global call_user_start
call_user_start:
l32r a12, .P_count
l32r a13, .P_offset
1:
mov a2, a13
l32r a3, .buffer
l32r a4, .P_size
add a13, a13, a4
l32r a5, .SPIRead
callx0 a5
l32r a2, .buffer
l32r a3, .P_size
l32r a4, .send_packet
callx0 a4
addi a12, a12, -1
bnez a12, 1b
2: j 2b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment