This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SW-TM4C: sample code of re-write own code section in own flash

Genius 3186 points
Part Number: SW-TM4C
Other Parts Discussed in Thread: TM4C1290NCPDT, EK-TM4C1294XL

Hi

May I have question about Tiva ware?

My customer is using TM4C1290NCPDT.

Is there any sample code of re-write own code section in own flash, ?
(binary that use for code update could download through SPI)

Thanks,

GR

  • Hi GR,

      I suppose you are referring to the bootloader using SSI interface. Yes, this is supported in both the ROM-based as well as Flash-based bootloader in our TivaWare SDK. 

    Please refer to the bl_config.h file to configure the bootloader for SSI bootloading. We do not have an example to demonstrate SSI bootloading. I will suggest you start with the UART bootloader and get a feel on how it works. You can then migrate to SSI bootloader. 

    //*****************************************************************************
    //
    // Selects the SSI port as the port for communicating with the boot loader.
    //
    // Depends on: None
    // Exclusive of: CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE,
    //               UART_ENABLE_UPDATE, USB_ENABLE_UPDATE
    // Requires: SSI_CLOCK_ENABLE, SSIx_BASE, SSI_CLKPIN_CLOCK_ENABLE, 
    //           SSI_CLKPIN_BASE, SSI_CLKPIN_PCTL, SSI_CLKPIN_POS, 
    //           SSI_FSSPIN_CLOCK_ENABLE, SSI_FSSPIN_BASE, SSI_FSSPIN_PCTL,
    //           SSI_FSSPIN_POS, SSI_MISOPIN_CLOCK_ENABLE, SSI_MISOPIN_BASE,
    //           SSI_MISOPIN_PCTL, SSI_MISOPIN_POS, SSI_MOSIPIN_CLOCK_ENABLE,
    //           SSI_MOSIPIN_BASE, SSI_MOSIPIN_PCTL and SSI_MOSIPIN_POS
    //
    //*****************************************************************************
    //#define SSI_ENABLE_UPDATE
    
    //*****************************************************************************
    //
    // Selects the clock enable for the SSI peripheral module
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSIx_BASE
    //
    //*****************************************************************************
    //#define SSI_CLOCK_ENABLE          SYSCTL_RCGCSSI_R0
    
    //*****************************************************************************
    //
    // Selects the base address of the SSI peripheral module
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_CLOCK_ENABLE
    //
    //*****************************************************************************
    //#define SSIx_BASE          SSI0_BASE
    
    //*****************************************************************************
    //
    // Selects the clock enable for the GPIO corresponding to SSI CLK pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_CLKPIN_BASE, SSI_CLKPIN_PCTL and SSI_CLKPIN_POS
    //
    //*****************************************************************************
    //#define SSI_CLKPIN_CLOCK_ENABLE          SYSCTL_RCGCGPIO_R0
    
    //*****************************************************************************
    //
    // Selects the base address for the GPIO corresponding to SSI CLK pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_CLKPIN_CLOCK_ENABLE, SSI_CLKPIN_PCTL and SSI_CLKPIN_POS
    //
    //*****************************************************************************
    //#define SSI_CLKPIN_BASE          GPIO_PORTA_BASE
    
    //*****************************************************************************
    //
    // Selects the port control value for the GPIO corresponding to SSI CLK pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_CLKPIN_CLOCK_ENABLE, SSI_CLKPIN_BASE and SSI_CLKPIN_POS
    //
    //*****************************************************************************
    //#define SSI_CLKPIN_PCTL          0x2
    
    //*****************************************************************************
    //
    // Selects the pin number for the GPIO corresponding to SSI CLK pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_CLKPIN_CLOCK_ENABLE, SSI_CLKPIN_BASE and SSI_CLKPIN_PCTL
    //
    //*****************************************************************************
    //#define SSI_CLKPIN_POS          2
    
    //*****************************************************************************
    //
    // Selects the clock enable for the GPIO corresponding to SSI FSS pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_FSSPIN_BASE, SSI_FSSPIN_PCTL and SSI_FSSPIN_POS
    //
    //*****************************************************************************
    //#define SSI_FSSPIN_CLOCK_ENABLE          SYSCTL_RCGCGPIO_R0
    
    //*****************************************************************************
    //
    // Selects the base address for the GPIO corresponding to SSI FSS pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_FSSPIN_CLOCK_ENABLE, SSI_FSSPIN_PCTL and SSI_FSSPIN_POS
    //
    //*****************************************************************************
    //#define SSI_FSSPIN_BASE          GPIO_PORTA_BASE
    
    //*****************************************************************************
    //
    // Selects the port control value for the GPIO corresponding to SSI FSS pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_FSSPIN_CLOCK_ENABLE, SSI_FSSPIN_BASE and SSI_FSSPIN_POS
    //
    //*****************************************************************************
    //#define SSI_FSSPIN_PCTL          0x2
    
    //*****************************************************************************
    //
    // Selects the pin number for the GPIO corresponding to SSI FSS pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_FSSPIN_CLOCK_ENABLE, SSI_FSSPIN_BASE and SSI_FSSPIN_PCTL
    //
    //*****************************************************************************
    //#define SSI_FSSPIN_POS          3
    
    //*****************************************************************************
    //
    // Selects the clock enable for the GPIO corresponding to SSI MISO pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_MISOPIN_BASE, SSI_MISOPIN_PCTL and SSI_MISOPIN_POS
    //
    //*****************************************************************************
    //#define SSI_MISOPIN_CLOCK_ENABLE          SYSCTL_RCGCGPIO_R0
    
    //*****************************************************************************
    //
    // Selects the base address for the GPIO corresponding to SSI MISO pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_MISOPIN_CLOCK_ENABLE, SSI_MISOPIN_PCTL and SSI_MISOPIN_POS
    //
    //*****************************************************************************
    //#define SSI_MISOPIN_BASE          GPIO_PORTA_BASE
    
    //*****************************************************************************
    //
    // Selects the port control value for the GPIO corresponding to SSI MISO pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_MISOPIN_CLOCK_ENABLE, SSI_MISOPIN_BASE and SSI_MISOPIN_POS
    //
    //*****************************************************************************
    //#define SSI_MISOPIN_PCTL          0x2
    
    //*****************************************************************************
    //
    // Selects the pin number for the GPIO corresponding to SSI MISO pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_MISOPIN_CLOCK_ENABLE, SSI_MISOPIN_BASE and SSI_MISOPIN_PCTL
    //
    //*****************************************************************************
    //#define SSI_MISOPIN_POS          5
    
    //*****************************************************************************
    //
    // Selects the clock enable for the GPIO corresponding to SSI MOSI pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_MOSIPIN_BASE, SSI_MOSIPIN_PCTL and SSI_MOSIPIN_POS
    //
    //*****************************************************************************
    //#define SSI_MOSIPIN_CLOCK_ENABLE          SYSCTL_RCGCGPIO_R0
    
    //*****************************************************************************
    //
    // Selects the base address for the GPIO corresponding to SSI MOSI pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_MOSIPIN_CLOCK_ENABLE, SSI_MOSIPIN_PCTL and SSI_MOSIPIN_POS
    //
    //*****************************************************************************
    //#define SSI_MOSIPIN_BASE          GPIO_PORTA_BASE
    
    //*****************************************************************************
    //
    // Selects the port control value for the GPIO corresponding to SSI MOSI pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_MOSIPIN_CLOCK_ENABLE, SSI_MOSIPIN_BASE and SSI_MOSIPIN_POS
    //
    //*****************************************************************************
    //#define SSI_MOSIPIN_PCTL          0x2
    
    //*****************************************************************************
    //
    // Selects the pin number for the GPIO corresponding to SSI MOSI pin
    //
    // Depends on: SSI_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: SSI_MOSIPIN_CLOCK_ENABLE, SSI_MOSIPIN_BASE and SSI_MOSIPIN_PCTL
    //
    //*****************************************************************************
    //#define SSI_MOSIPIN_POS          4

    The UART bootloader example can be found in C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\boot_serial. You can also find the an example UART application that goes along with the bootloader. It can be found at C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\boot_demo1. The boot_serial will boot and load boot_demo1 through the UART interface. Once you get this working, you can adapt for SSI interface. 

  • Hi Tsai,

    Thanks for your information.

    I understand it.

    I will reference UART bootloadar.

    Best regards,

    GR