-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add BOOT_LOAD_PIN, update BL from SRAM and Jeff Probe Board #203
base: master
Are you sure you want to change the base?
Conversation
…h bootloader from SRAM which does not touch application code
do not leave dotstar on after exiting bootloader
…h bootloader from SRAM which does not touch application code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor format cleanups: I'd like to be consistent about code formatting style.
These commits are several months old; I was confused, but I think you're just pushing them now?
Have you built and tested this code base on some standard board (say an Adafruit one) without the new options being enabled? Thanks.
@@ -229,7 +239,22 @@ void write_block(uint32_t block_no, uint8_t *data, bool quiet, WriteState *state | |||
// copied from a device; we still want to count these blocks to reset properly | |||
} else { | |||
// logval("write block at", bl->targetAddr); | |||
#ifdef SRAM_BL_SIZE | |||
if ( use_flash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( use_flash) { | |
if (use_flash) { |
if ( use_flash) { | ||
flash_write_row((void *)bl->targetAddr, (void *)bl->data); | ||
*DBL_TAP_PTR = 0; | ||
}else{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}else{ | |
} else { |
uint32_t addr_limit = boot_sram ? SRAM_BASE_ADDR+SRAM_BL_SIZE : FLASH_SIZE; | ||
|
||
app_start_address = *(uint32_t *)( base_addr + 4 ); | ||
if ( app_start_address < base_addr || app_start_address > addr_limit ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( app_start_address < base_addr || app_start_address > addr_limit ){ | |
if (app_start_address < base_addr || app_start_address > addr_limit) { |
*DBL_TAP_PTR = 0; | ||
}else{ | ||
memcpy((void*)bl->targetAddr, (void*)bl->data, FLASH_ROW_SIZE); | ||
if ( bl->targetAddr == SRAM_BASE_ADDR ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( bl->targetAddr == SRAM_BASE_ADDR ){ | |
if (bl->targetAddr == SRAM_BASE_ADDR) { |
memcpy((void*)bl->targetAddr, (void*)bl->data, FLASH_ROW_SIZE); | ||
if ( bl->targetAddr == SRAM_BASE_ADDR ){ | ||
uint32_t bootAddr = bl->data[4] | (bl->data[5]<<8) | (bl->data[6]<<16) | (bl->data[7]<<24); | ||
if( bootAddr > SRAM_BASE_ADDR && bootAddr < (SRAM_BASE_ADDR + SRAM_BL_SIZE) ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if( bootAddr > SRAM_BASE_ADDR && bootAddr < (SRAM_BASE_ADDR + SRAM_BL_SIZE) ){ | |
if (bootAddr > SRAM_BASE_ADDR && bootAddr < (SRAM_BASE_ADDR + SRAM_BL_SIZE)) { |
@@ -126,6 +159,10 @@ static void check_start_application(void) { | |||
if (RESET_CONTROLLER->RCAUSE.bit.POR) { | |||
*DBL_TAP_PTR = 0; | |||
} | |||
#ifdef SRAM_BL_SIZE | |||
else if ( *DBL_TAP_PTR == DBL_TAP_MAGIC_SRAM_BL ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else if ( *DBL_TAP_PTR == DBL_TAP_MAGIC_SRAM_BL ) { | |
else if (*DBL_TAP_PTR == DBL_TAP_MAGIC_SRAM_BL) { |
@@ -191,8 +195,10 @@ int main(void) { | |||
// bootloader doesn't run us a second time. We don't need to erase to write | |||
// zeros. The remainder of the write unit will be set to 1s which should | |||
// preserve the existing values but its not critical. | |||
#if ( (! defined(SRAM_BL_SIZE)) || defined(USE_STD_FLASH_BL) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if ( (! defined(SRAM_BL_SIZE)) || defined(USE_STD_FLASH_BL) ) | |
#if ((!defined(SRAM_BL_SIZE)) || defined(USE_STD_FLASH_BL)) |
@@ -79,7 +79,12 @@ int writeNum(char *buf, uint32_t n, bool full) { | |||
void resetIntoApp() { | |||
// reset without waiting for double tap (only works for one reset) | |||
RGBLED_set_color(COLOR_LEAVE); | |||
#ifdef SRAM_BL_SIZE | |||
if ( *DBL_TAP_PTR != DBL_TAP_MAGIC_SRAM_BL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( *DBL_TAP_PTR != DBL_TAP_MAGIC_SRAM_BL) | |
if (*DBL_TAP_PTR != DBL_TAP_MAGIC_SRAM_BL) |
This request to add the following features and board: