Management of boot and upgrade images without libflash

Technical questions regarding the XTC tools and programming with XMOS.
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Management of boot and upgrade images without libflash

Post by DemoniacMilk »

In the current project, an xcore device is talking to a flash and a DSP via SPI. Tha plan was to interface the two devices using seperate SPI interfaces. That way, libflash could be used for handling everything related to flash memory and lib_spi for communicating with the DSP.

Unfortunately, we exceed the number of available 1 bit ports with this setup, so the plan is to use just one SPI interface for both flash and DSP.

As a result, handling the xcores boot images needs to be done manually. libflash source code seems to not be accessible. I dont know what the requirements for factory/upgrade images are for the standard xmos boot loader to correctly recognize them. Where may i find the information necessary to manually do what libflash does? Or is there an SPI solution using multip-bit-ports (allowing to free some 1 bit ports)?
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

One solution would be to add a "shutdown" function to the lib_spi SPI master and make it re-entrant. Then you could have one task talking to the DSP and, when needed, switching over to libflash and talking to the flash.

Code: Select all

    while (1) {
        par {
          spi_master(i_spi_master);
          { dsp(i_spi_master, c_spi_control);
            // c_spi_control said go to flash
            i_spi_master.shutdown();
          }
        }
        do_libflash_stuff(c_spi_control);
    }
The spi_master function is combinable, so you should only use up one core for this.
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

Neat idea. But this requires an additional chanend? Already used 31 of 32 on tile 0 and not everything has been implemented yet, so I probably have to find ways to cut some of those as well at some point.

For now the SPI flash was replaced with an SQI flash, freeing two 1bit ports. Some low frequency signals were moved to tile 1 ports with help of the gpio library, so in total there are three 1-bit ports not used for now.