OpenCores
URL https://opencores.org/ocsvn/s6soc/s6soc/trunk

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [host/] [zipload.cpp] - Diff between revs 14 and 19

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 14 Rev 19
Line 491... Line 491...
                                        secp->m_start, secp->m_start+secp->m_len);
                                        secp->m_start, secp->m_start+secp->m_len);
                                exit(EXIT_FAILURE);
                                exit(EXIT_FAILURE);
                        }
                        }
                }
                }
 
 
 
                unsigned        startaddr = RESET_ADDRESS, codelen = 0;
                for(int i=0; secpp[i]->m_len; i++) {
                for(int i=0; secpp[i]->m_len; i++) {
                        secp = secpp[i];
                        secp = secpp[i];
                        if ((secp->m_start >= RAMBASE)
                        if ((secp->m_start >= RAMBASE)
                                &&(secp->m_start+secp->m_len
                                &&(secp->m_start+secp->m_len
                                                <= RAMBASE+MEMWORDS)) {
                                                <= RAMBASE+MEMWORDS)) {
                                for(int i=0; (unsigned)i<secp->m_len; i++) {
                                for(int i=0; (unsigned)i<secp->m_len; i++) {
                                        if (secp->m_data[i] != 0) {
                                        if (secp->m_data[i] != 0) {
                                                fprintf(stderr, "ERR: Cannot set RAM upon bootup!\n");
                                                fprintf(stderr, "ERR: Cannot set RAM upon bootup!\n");
                                                fprintf(stderr, "(The bootloaders just not that smart ... yet)\n");
                                                fprintf(stderr, "(The bootloaders just not that smart ... yet)\n");
 
                                                fprintf(stderr, "Attempting to set %08x - %08x\n", secp->m_start, secp->m_start+secp->m_len-1);
 
                                                fprintf(stderr, "%08x cannot be set to %08x\n", secp->m_start+i, secp->m_data[i]);
                                                exit(EXIT_FAILURE);
                                                exit(EXIT_FAILURE);
                                        }
                                        }
                                }
                                }
                        } else if (!flash->write(secp->m_start, secp->m_len, secp->m_data, true)) {
                        } else {
 
                                if (secp->m_start < startaddr) {
 
                                        codelen += (startaddr-secp->m_start);
 
                                        startaddr = secp->m_start;
 
                                } if (secp->m_start+secp->m_len > startaddr+codelen) {
 
                                        codelen = secp->m_start+secp->m_len-startaddr;
 
                                } memcpy(&fbuf[secp->m_start-SPIFLASH],
 
                                        secp->m_data,
 
                                        secp->m_len*sizeof(FPGA::BUSW));
 
                        }
 
                }
 
                if (!flash->write(startaddr, codelen, &fbuf[startaddr-SPIFLASH], true)) {
                                fprintf(stderr, "ERR: Could not write program to flash\n");
                                fprintf(stderr, "ERR: Could not write program to flash\n");
                                exit(EXIT_FAILURE);
                                exit(EXIT_FAILURE);
                        }
                        }
                }
 
                m_fpga->readio(R_VERSION); // Check for bus errors
                m_fpga->readio(R_VERSION); // Check for bus errors
 
 
                // Now ... how shall we start this CPU?
                // Now ... how shall we start this CPU?
                printf("The CPU should be fully loaded, you may now start\n");
                printf("The CPU should be fully loaded, you may now start\n");
                printf("it.  To start the CPU, either toggle power or type\n");
                printf("it.  To start the CPU, either toggle power or type\n");

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.