Forum Discussion

EEren's avatar
EEren
Icon for Occasional Contributor rankOccasional Contributor
7 years ago

MAX10 Dual Boot.

On CFM0 I have a bootloader. I create rpd file from a main project and burn it on CFM1.

After successful burning I switch BOOT_SELECT to boot from CFM1. However the main project

failed to run and the boot runs.

Where can I find some instructions how to create valid rpd file and burn it into CFM1.

9 Replies

  • AnandRaj_S_Intel's avatar
    AnandRaj_S_Intel
    Icon for Regular Contributor rankRegular Contributor

    Hi,

    Refer the links and demo projects.

    AN 730: Nios II Processor Booting Methods in MAX 10 FPGA Devices

    https://fpgacloud.intel.com/devstore/platform/16.0.0/Standard/dualboot-design-example/

    https://fpgawiki.intel.com/uploads/0/00/Using_Dual_Boot_MAX_10_Evaluation_Kit.pdf

    https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/an/an741.pdf

    Let me know if this has helped resolve the issue you are facing or if you need any further assistance.

    Best Regards,

    Anand Raj Shankar

    (This message was posted on behalf of Intel Corporation)

  • EEren's avatar
    EEren
    Icon for Occasional Contributor rankOccasional Contributor

    I did as described in the document. However it dosen't work after programming prd file into CFM1. The master project should be configured as a single or a double image?

  • EEren's avatar
    EEren
    Icon for Occasional Contributor rankOccasional Contributor

    prd file is a binary file. should I reverse bytes before programming? and what is the order of bytes?

    this

    word_to_write = (UInt32)((reversed_byte[raw_data[i]] << 24) | (reversed_byte[raw_data[i + 1]] << 16) |   (reversed_byte[raw_data[i + 2]] << 8) | reversed_byte[raw_data[i + 3]]);

    or this

    word_to_write = (UInt32)((reversed_byte[raw_data[i + 3]] << 24) | (reversed_byte[raw_data[i + 2]] << 16) |   (reversed_byte[raw_data[i + 1]] << 8) | reversed_byte[raw_data[i]]);
  • EEren's avatar
    EEren
    Icon for Occasional Contributor rankOccasional Contributor

    May be I burn in the wrong sector? in my module flash_update generics are

    SECTOR3_START_ADDR         => 16384,
    SECTOR3_END_ADDR             => 114687,
    SECTOR4_START_ADDR         => 114688,
    SECTOR4_END_ADDR             => 188415,
    SECTOR5_START_ADDR          => 188416,
    SECTOR5_END_ADDR              => 360447,

    As I understood SECTOR5 is CFM0 and SECTOR3-SECTOR4 is CFM1.

  • AnandRaj_S_Intel's avatar
    AnandRaj_S_Intel
    Icon for Regular Contributor rankRegular Contributor

    Hi,

    1. Project related to dual configuration should be configured as double image.
    2. Should I reverse bytes before programming? No.

    For more information please check the below links.

    https://www.youtube.com/watch?v=0k4AZmdW9Sk

    https://www.youtube.com/watch?v=Z0l0GrjXn8w

    Let me know if this has helped resolve the issue you are facing or if you need any further assistance.

    Best Regards,

    Anand Raj Shankar

    (This message was posted on behalf of Intel Corporation)

  • EEren's avatar
    EEren
    Icon for Occasional Contributor rankOccasional Contributor

    I write the rpd file. Let's take the first bytes from the file 50 FF 47 FF. But when I read it back from the flash I get FF 50 FF 47.

    What's going on! Who can me explain for for Christ's sake!

  • AnandRaj_S_Intel's avatar
    AnandRaj_S_Intel
    Icon for Regular Contributor rankRegular Contributor

    Hi,

    1. Bit reversal is required if you have used little-Indian option while generating the .pof file. Which is default.
    2. If Big-Indian option is used bit reversal is not required
    3. Example design is attached

    Best Regards,

    Anand Raj Shankar

    (This message was posted on behalf of Intel Corporation)

  • EEren's avatar
    EEren
    Icon for Occasional Contributor rankOccasional Contributor

    Hi Anand

    Thank you for the example.

    I have something to clarify

    for(address=CFM1StartAddress;address<=CFM1EndAddress;address=address+4)
    {
    scanf("%2x%2x%2x%2x",&receivedHex[0],&receivedHex[1],&receivedHex[2],&receivedHex[3]); /*Get 4 bytes from UART Terminal*/
    for(byte=0; byte<4; byte++)
    {
    receivedHex[byte] = (((receivedHex[byte] & 0xaa)>>1)|((receivedHex[byte] & 0x55)<<1));		/*Swap LSB with MSB before write into CFM*/
    receivedHex[byte] = (((receivedHex[byte] & 0xcc)>>2)|((receivedHex[byte] & 0x33)<<2));
    receivedHex[byte] = (((receivedHex[byte] & 0xf0)>>4)|((receivedHex[byte] & 0x0f)<<4));
     	}
     
    word = (receivedHex[0]<<24)|(receivedHex[1]<<16)|(receivedHex[2]<<8)|(receivedHex[3]);	/*Combine 4 bytes to become 1 word before write operation*/
    	IOWR_32DIRECT(ONCHIP_FLASH_0_DATA_BASE, address, word);					/*Command to write into On-Chip Flash IP*/
    	byte = 0;
    	word = 0x0;
    	while((IORD(ONCHIP_FLASH_0_CSR_BASE, 0) & 0x0b) == 0x02)
    		{
    			  	printf("Writing CFM1(%d)\n",address);
    		}
    		if((IORD(ONCHIP_FLASH_0_CSR_BASE, 0) & 0x0b) == 0x00)
    			{
    			  		printf("Write to %d failed\n", address);
    			  		state=20;
    			  		address = 700000;
    			}
    			if((IORD(ONCHIP_FLASH_0_CSR_BASE, 0) & 0x0b) == 0x08)
    			{
     
    			}
     
    	}

    This part

    for(byte=0; byte<4; byte++)
    {
    /*Swap LSB with MSB before write into CFM*/
    receivedHex[byte] = (((receivedHex[byte] & 0xaa)>>1)|((receivedHex[byte] & 0x55)<<1));		
    receivedHex[byte] = (((receivedHex[byte] & 0xcc)>>2)|((receivedHex[byte] & 0x33)<<2));
    receivedHex[byte] = (((receivedHex[byte] & 0xf0)>>4)|((receivedHex[byte] & 0x0f)<<4));
    }

    I shouldn't do if I have Big-Indian option or I should swap MSB and LSB anyway?