Compare commits
3 Commits
614d875d9a
...
f7b99dd76c
Author | SHA1 | Date |
---|---|---|
King Kévin | f7b99dd76c | |
King Kévin | 3577f1a0f4 | |
King Kévin | 5e154a57e3 |
|
@ -279,7 +279,7 @@ static void process_command(char* str)
|
||||||
void main(void);
|
void main(void);
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
rcc_clock_setup_in_hse_8mhz_out_72mhz(); // use 8 MHz high speed external clock to generate 72 MHz internal clock
|
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]); // use 8 MHz high speed external clock to generate 72 MHz internal clock
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// enable functionalities for easier debug
|
// enable functionalities for easier debug
|
||||||
|
|
|
@ -83,7 +83,7 @@ void main(void)
|
||||||
(*(void(**)(void))((uint32_t)application + 4))(); // start application (by jumping to the reset function which address is stored as second entry of the vector table)
|
(*(void(**)(void))((uint32_t)application + 4))(); // start application (by jumping to the reset function which address is stored as second entry of the vector table)
|
||||||
}
|
}
|
||||||
|
|
||||||
rcc_clock_setup_in_hse_8mhz_out_72mhz(); // start main clock
|
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]); // start main clock
|
||||||
board_setup(); // setup board to control LED
|
board_setup(); // setup board to control LED
|
||||||
led_on(); // indicate bootloader started
|
led_on(); // indicate bootloader started
|
||||||
#if defined(BUSVOODOO)
|
#if defined(BUSVOODOO)
|
||||||
|
|
|
@ -37,7 +37,7 @@ static void flash_internal_init(void)
|
||||||
if ((uint32_t)&__flash_end >= FLASH_BASE) {
|
if ((uint32_t)&__flash_end >= FLASH_BASE) {
|
||||||
flash_internal_end = (uint32_t)&__flash_end;
|
flash_internal_end = (uint32_t)&__flash_end;
|
||||||
} else {
|
} else {
|
||||||
flash_internal_end = FLASH_BASE + DESIG_FLASH_SIZE * 1024;
|
flash_internal_end = FLASH_BASE + desig_get_flash_size() * 1024;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ static bool flash_internal_range(uint32_t address, size_t size)
|
||||||
uint16_t flash_internal_page_size(void)
|
uint16_t flash_internal_page_size(void)
|
||||||
{
|
{
|
||||||
if (0 == flash_internal_page) { // we don't know the page size yet
|
if (0 == flash_internal_page) { // we don't know the page size yet
|
||||||
if (DESIG_FLASH_SIZE < 256) {
|
if (desig_get_flash_size() < 256) {
|
||||||
if ((*(uint32_t*)0x1FFFF000 & 0xFFFE0000) == 0x20000000) { // non-connectivity system memory start detected (MSP address pointing to SRAM
|
if ((*(uint32_t*)0x1FFFF000 & 0xFFFE0000) == 0x20000000) { // non-connectivity system memory start detected (MSP address pointing to SRAM
|
||||||
flash_internal_page = 1024;
|
flash_internal_page = 1024;
|
||||||
} else { // connectivity system memory start is at 0x1FFFB000
|
} else { // connectivity system memory start is at 0x1FFFB000
|
||||||
|
@ -224,7 +224,7 @@ void flash_internal_eeprom_setup(uint16_t pages)
|
||||||
|
|
||||||
flash_internal_eeprom_start = 0; // reset start address
|
flash_internal_eeprom_start = 0; // reset start address
|
||||||
flash_internal_eeprom_address = 0; // reset EEPROM address
|
flash_internal_eeprom_address = 0; // reset EEPROM address
|
||||||
if (pages > DESIG_FLASH_SIZE * 1024 / flash_internal_page) { // not enough pages are available
|
if (pages > desig_get_flash_size() * 1024 / flash_internal_page) { // not enough pages are available
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
flash_internal_eeprom_start = flash_internal_end - flash_internal_page * pages; // set EEPROM start (page aligned)
|
flash_internal_eeprom_start = flash_internal_end - flash_internal_page * pages; // set EEPROM start (page aligned)
|
||||||
|
@ -313,7 +313,7 @@ uint32_t flash_internal_probe_read_size(void)
|
||||||
|
|
||||||
uint32_t flash_internal_probe_write_size(void)
|
uint32_t flash_internal_probe_write_size(void)
|
||||||
{
|
{
|
||||||
if (0 == DESIG_FLASH_SIZE) { // no flash size advertised
|
if (0 == desig_get_flash_size()) { // no flash size advertised
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ uint32_t flash_internal_probe_write_size(void)
|
||||||
// prepare for writing the flash
|
// prepare for writing the flash
|
||||||
flash_unlock(); // unlock flash to be able to write it
|
flash_unlock(); // unlock flash to be able to write it
|
||||||
// try reading and writing the flash, page per page
|
// try reading and writing the flash, page per page
|
||||||
uint32_t start = FLASH_BASE + DESIG_FLASH_SIZE * 1024; // start with the end of the advertised flash
|
uint32_t start = FLASH_BASE + desig_get_flash_size() * 1024; // start with the end of the advertised flash
|
||||||
if ((uint32_t)&__flash_end >= FLASH_BASE) { // use linker flash size if provided
|
if ((uint32_t)&__flash_end >= FLASH_BASE) { // use linker flash size if provided
|
||||||
start = (uint32_t)&__flash_end;
|
start = (uint32_t)&__flash_end;
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,7 @@ static enum usbd_request_return_codes usb_dfu_control_request(usbd_device *usbd_
|
||||||
// application data is exceeding enforced flash size for application
|
// application data is exceeding enforced flash size for application
|
||||||
usb_dfu_status = DFU_STATUS_ERR_ADDRESS;
|
usb_dfu_status = DFU_STATUS_ERR_ADDRESS;
|
||||||
usb_dfu_state = STATE_DFU_ERROR;
|
usb_dfu_state = STATE_DFU_ERROR;
|
||||||
} else if ((uint32_t)&__application_end < FLASH_BASE && (uint32_t)&__application_beginning + download_offset + download_length >= (uint32_t)(FLASH_BASE + DESIG_FLASH_SIZE * 1024)) {
|
} else if ((uint32_t)&__application_end < FLASH_BASE && (uint32_t)&__application_beginning + download_offset + download_length >= (uint32_t)(FLASH_BASE + desig_get_flash_size() * 1024)) {
|
||||||
// application data is exceeding advertised flash size
|
// application data is exceeding advertised flash size
|
||||||
usb_dfu_status = DFU_STATUS_ERR_ADDRESS;
|
usb_dfu_status = DFU_STATUS_ERR_ADDRESS;
|
||||||
usb_dfu_state = STATE_DFU_ERROR;
|
usb_dfu_state = STATE_DFU_ERROR;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit cb0661f81de5b1cae52ca99c7b5985b678176db7
|
Subproject commit 664701d7a7f169235c457a3dd117415647aac61b
|
Loading…
Reference in New Issue