1
0
mirror of https://github.com/mist-devel/mist-firmware.git synced 2026-04-29 05:26:02 +00:00

Properly re-initialize firmware when core loaded by USB Blaster (with DIP SW1=OFF).

This commit is contained in:
sorgelig
2016-01-05 23:09:54 +08:00
parent 7098bb8009
commit dd5b9511f2
4 changed files with 11 additions and 5 deletions

View File

@@ -26,8 +26,8 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x00100000, LENGTH = 0x00040000
DATA (rw) : ORIGIN = 0x00200000, LENGTH = 0x00010000
STACK (rw) : ORIGIN = 0x00210000, LENGTH = 0x00000000
DATA (rw) : ORIGIN = 0x00200000, LENGTH = 0x0000FF00
STACK (rw) : ORIGIN = 0x0020FF00, LENGTH = 0x00000000
}

6
fpga.c
View File

@@ -846,8 +846,12 @@ unsigned char GetFPGAStatus(void)
void fpga_init(char *name) {
unsigned long time = GetTimer(0);
int loaded_from_usb = USB_LOAD_VAR;
if(!user_io_dip_switch1() || name) {
iprintf("loaded_from_usb = %d\n", USB_LOAD_VAR == USB_LOAD_VALUE);
USB_LOAD_VAR = 0;
if(loaded_from_usb != USB_LOAD_VALUE) {
unsigned char ct;
if (ConfigureFpga(name)) {

View File

@@ -656,7 +656,6 @@ void user_io_send_buttons(char force) {
void user_io_poll() {
if(user_io_dip_switch1()) {
// check of core has changed from a good one to a not supported on
// as this likely means that the user is reloading the core via jtag
unsigned char ct;
@@ -672,6 +671,7 @@ void user_io_poll() {
else {
// core type has changed
if(++ct_cnt == 255) {
USB_LOAD_VAR = USB_LOAD_VALUE;
// wait for a new valid core id to appear
while((ct & 0xf0) != 0xa0) {
EnableIO();
@@ -685,7 +685,6 @@ void user_io_poll() {
for(;;);
}
}
}
if((core_type != CORE_TYPE_MINIMIG) &&
(core_type != CORE_TYPE_MINIMIG2) &&

View File

@@ -161,4 +161,7 @@ void user_io_send_buttons(char);
void user_io_key_remap(char *);
#define USB_LOAD_VAR *(int*)(0x0020FF04)
#define USB_LOAD_VALUE 12345678
#endif // USER_IO_H