Read about our upcoming Code of Conduct on this issue

Commit 405bd131 authored by hudson@andromeda.local's avatar hudson@andromeda.local
Browse files

Flag autoboot versus a firmware update

--HG--
branch : 550d
parent cc1c1fd4d878
......@@ -51,6 +51,9 @@ static uint8_t _reloc[ RELOCSIZE ];
#define FIXUP_BRANCH( rom_addr, dest_addr ) \
INSTR( rom_addr ) = BL_INSTR( &INSTR( rom_addr ), (dest_addr) )
/** Was this an autoboot or firmware file load? */
int autoboot_loaded;
/** Specified by the linker */
extern uint32_t _bss_start[], _bss_end[];
......@@ -66,10 +69,13 @@ zero_bss( void )
void
__attribute__((noreturn,noinline,naked))
copy_and_restart( void )
copy_and_restart( int offset )
{
zero_bss();
// Set the flag if this was an autoboot load
autoboot_loaded = (offset == 0);
// Copy the firmware to somewhere safe in memory
const uint8_t * const firmware_start = (void*) ROMBASEADDR;
const uint32_t firmware_len = RELOCSIZE;
......
......@@ -677,4 +677,8 @@ free_dma_memory(
);
/** Set if the firmware was loaded via AUTOEXEC.BIN */
extern int autoboot_loaded;
#endif
......@@ -121,14 +121,14 @@ cstart( void )
flush_caches();
// Jump into the newly relocated code
void __attribute__((noreturn))(*copy_and_restart)(void)
void __attribute__((noreturn))(*copy_and_restart)(int)
= (void*) RESTARTSTART;
void __attribute__((noreturn))(*firmware_start)(void)
= (void*) ROMBASEADDR;
if( 1 )
copy_and_restart();
copy_and_restart(offset);
else
firmware_start();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment