AM263Px MCU+ SDK: SBL QSPI ENET

| AM263Px MCU+ SDK 26.00.00 |

SBL QSPI ENET

# Introduction

This bootloader performs SOC initializations and offers additional functionality, including:

1. Receiving an application images via UDP over Ethernet.
2. Flashing the received application to OSPI Flash Memory.
3. Attempting to boot a multicore appimage present at 0x81000 location in the OSPI Flash. This offset is specified in the OSPI bootloader and when the EVM boots in OSPI mode, it will attempt to find an application at this location.

To flash a multicore appimage at this location, follow the steps mentioned in Basic steps to flash files.

On AM263PX, we can do ethernet based communication using CPSW as HW mechanism

- CPSW is a standard ethernet switch + port HW
- It uses ethernet driver underneath

The transfer of the user application image works in conjunction with the enet_uniflash.py python script mentioned in Flashing Tools.

If a multicore appimage is found at the location, the SBL parses it, splits it into RPRCs for each core applicable. Each core is then initialized, RPRC image is loaded, entry points are set and the core is released from reset. For more on bootflow/bootloaders, please refer Understanding the bootflow and bootloaders

Note that the SBL is transferred solely through UART, whereas the files that the SBL processes are transmitted over Ethernet.

Note
  To ensure the sbl_ospi_enet SBL remains intact, allocate a reserved area of 0x13C000 in MSRAM within the application image's linker script. This precaution prevents the application image from overwriting the SBL during Ethernet-based flashing.
  MSRAM specifications:
  1. Total size: 0x0200000
  2. HSMRT module allocation: 0x40000
  3. ENET libraries/components allocation approximately: 0xB0000
  4. Scratch pad allocation: 0x8000
  The remaining 0x13C000 space is reserved for the application image.

# Supported Combinations

Parameter | Value
--- | ---
CPU + OS | r5fss0-0 nortos
Toolchain | ti-arm-clang
Board | am263px-cc
Example folder | examples/drivers/boot/sbl_ospi_enet

## Application Flow

The below flow diagram shows the application flow for the reception of an application image via UDP over ethernet on boot of the sbl_ospi_enet SBL.

Flow Path

This SBL application consumes more MSRAM memory (>0x20000) as compared to the sbl_uart_uniflash SBL due to the increased size of the ethernet driver library.

## Create a network between EVM and host PC

### Linux (Ubuntu 22.04):

The instructions provided below have been validated on Ubuntu(v22.04), but are also applicable to other operating systems. The scripts included in MCU+SDK are designed to be compatible with multiple host PC operating systems, ensuring seamless execution across different platforms.

1. Setup the static IP on the interface connected to the board using the following command:

The below steps are for the network interface corresponding to the ethernet connection between the PC and EVM.

Note that the IP addresses utilized in this configuration are also referenced in the Python script and EVM application. To avoid potential conflicts with existing devices, it is essential to update the IP addresses consistently across all relevant components.

- Connect an ethernet cable between the PC and the EVM(Here in this case AM263 Control Card, Port 1)
- This will reflect all the interfaces connected to the linux host PC.
  ifconfig
- static-IP is hardcoded in sbl_enet.h as:
  /* EVM IP ADDRESS */
  #define ENET_SOURCE_IP_ADDRESS { 192U, 168U, 0U, 195U }
  /* Host PC IP Address */
  #define ENET_DESTINATION_IP_ADDRESS { 192U, 168U, 0U, 136U }
  sudo ifconfig <interface-name> <static-HOST-IP>
- Due to the absence of ARP services (typially provided by LwIP) in this Uniflash application, manual configuration of an ARP entry for the EVM is required. This ensures that the PC does not discard incoming packets from the EVM due to Unknown Unicast address.
  sudo arp -i <interface-name> -s <EVM-static-IP> <EVM-MAC-address>

EVM MAC Address can be found in the SBL UART console. In this case it is: 70:ff:76:1d:ec:f2

Attention
  Make sure to set the value of the MACRO ENET_HOST_PC_MAC_ADDRESS in the file sbl_enet.h to the MAC address of the corresponding ethernet interface of Linux Host PC:
  /* Host PC MAC Address */
  #define ENET_HOST_PC_MAC_ADDRESS { 0xC0, 0x18, 0x03, 0xBD, 0xB2, 0x7B}

# Steps to Run the Example

Since this is a bootloader, the example will be run every time you boot an application using this example. It is run from a OSPI boot media unlike other examples which are usually loaded with CCS. Nevertheless, you can build this example like you do for the others using makefile or build it via CCS by importing as a project.

- When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).
- When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)
- Refer to the page Basic steps to flash files to flash the sbl_ospi_enet bootloader to the EVM in UART Boot Mode. Ensure that you should flash the sbl_ospi_enet bootloader, rather than the default sbl_ospi bootloader. Optionally, you can also flash the application image to the OSPI flash memory at offset 0x81000 as mentioned in Basic steps to flash files. Alternatively, you can omit this step and transmit the application image over Ethernet using the procedure outlined below.
- Once the sbl_ospi_enet bootloader image is flashed on the EVM, switch to OSPI Boot Mode and refer to the page Basic steps to flash files over ethernet to send an application image over ethernet to the EVM.

# See Also

BOOTLOADER

# Sample Output

Below is an example log from the serial teminal, demonstrating a normal boot process in ENETSBL_TIMER_MODE without image transfer. As shown, the bootloader bypasses the transfer step and proceeds to boot the user application image:

[ ENETSBL ] Starting Ethernet Transfer ...
EnetPhy_bindDriver: PHY 0: OUI:080028 Model:23 Ver:01 <-> 'dp83869' : OK
PHY 0 is alive
[ ENETSBL ] initQs() txFreePktInfoQ initialized with 16 pkts
[ ENETSBL ] EVM MAC address: 70:ff:76:1d:ec:f2
[ ENETSBL ] PHY 0 is alive
[ ENETSBL ] Please wait for Linkup ...
Cpsw_handleLinkUp: Port 2: Link up: 100-Mbps Full-Duplex
[ ENETSBL ] Linkup Done!
[ ENETSBL TIMEOUT ] Skipping enet transfer.
Cpsw_handleLinkDown: Port 2: Link down
Starting OSPI Bootloader ...
[BOOTLOADER_PROFILE] Boot Media : NOR SPI FLASH
[BOOTLOADER_PROFILE] Boot Media Clock : 80.000 MHz
[BOOTLOADER_PROFILE] Boot Image Size : 30 KB
[BOOTLOADER_PROFILE] Cores present :
r5f0-0
[BOOTLOADER PROFILE] System_init : 154us
[BOOTLOADER PROFILE] Drivers_open : 30us
[BOOTLOADER PROFILE] Board_driversOpen : 57us
[BOOTLOADER PROFILE] CPU load : 8483203us
[BOOTLOADER_PROFILE] SBL Total Time Taken : 8483448us
Image loading done, switching to application ...
INFO: Bootloader_runSelfCpu:217: All done, reseting self ...
Hello World!