Forum Discussion
Altera_Forum
Honored Contributor
15 years agoAndy, I think it is better when the user image also uses the altremote_update function. You can switsh betweeen the images. In case of a functional error in your user firmware you can fallback to the factory image. I'm using Active Serial and Remote in booth images.
I don't know how your altremote wrapper works. My wrapper has an Avalon Slave Interface which allows to access the altremote register (they called parameter in altremote userguide) and to control the reconfig port. The only thing what to do is to write the sector address of your user fpga image (not user firmware) on parameter 0x100. When your image is at address 0x300000 then you have to write the sector numer 48 to that parameter. (refer 3. Serial Configuration Devices EPCS1,EPCS4, EPCS16, EPCS64, and EPCS128 Data Sheet, table 3-4 in case of EPCS64). After parametrizing the sector to boot from you must assert a '1' to the reconfig pin of altremote_update block (this should be done by your wrapper hardware). Here is the component instantiation in the wrapper. The component was generated with MegaWizard. COMPONENT ru_rmtupdt_i7q
PORT (
reconfig : IN STD_LOGIC ;
param : IN STD_LOGIC_VECTOR (2 DOWNTO 0);
reset_timer : IN STD_LOGIC ;
read_param : IN STD_LOGIC ;
reset : IN STD_LOGIC ;
data_in : IN STD_LOGIC_VECTOR (11 DOWNTO 0);
busy : OUT STD_LOGIC ;
clock : IN STD_LOGIC ;
data_out : OUT STD_LOGIC_VECTOR (11 DOWNTO 0);
pgmout : OUT STD_LOGIC_VECTOR (2 DOWNTO 0);
write_param : IN STD_LOGIC
);
END COMPONENT;
And here is a little piece of firmware code:
switch (ulImage)
{
case 0:
//select factory image
IOWR_32DIRECT( pParam->Fpga.ulpSOPCBaseAddress, RU_PAGESEL_OFFSET*4, EPCS64_FACT_SECT );
usleep(100);
ulTempReg = IORD_32DIRECT( pParam->Fpga.ulpSOPCBaseAddress, RU_PAGESEL_OFFSET * 4 );
usleep(100);
if(ulTempReg != EPCS64_FACT_SECT)
{
ulMessageOut( "ReloadFPGA with Factory failed (wrong sector)!\n" );
return 1;
}
//reconfigure
IOWR_32DIRECT(pParam->Fpga.ulpSOPCBaseAddress, RU_CONFIGURE_OFFSET*4, 0x1);
usleep(100);
break;
case 1:
//select application image
IOWR_32DIRECT(pParam->Fpga.ulpSOPCBaseAddress, RU_PAGESEL_OFFSET*4, EPCS64_APP_SECT);
usleep(100);
ulTempReg = IORD_32DIRECT(pParam->Fpga.ulpSOPCBaseAddress, RU_PAGESEL_OFFSET*4);
usleep(100);
if(ulTempReg != EPCS64_APP_SECT)
{
ulMessageOut( "ReloadFPGA with Application failed (wrong sector)!\n" );
return 1;
}
//reconfigure
IOWR_32DIRECT(pParam->Fpga.ulpSOPCBaseAddress, RU_CONFIGURE_OFFSET*4, 0x1);
usleep(100);
} Jens