SAMA7G54-EK – Booting Demo Linux® Image

Last modified by Microchip on 2024/06/20 12:44

Introduction

This training lists step-by-step instructions for booting a demonstration Linux image to the SAMA7G54-EK Evaluation Kit. 

There are two methods, the first is to boot from a SD memory card and the second from the onboard e.MMC Flash memory. There are several pre-compiled demonstration Linux images available from the Linux4sam website. 

What you will need: 

  • SAMA7G54-EK Evaluation Kit 
  • Two micro-B USB cables (included in the SAMA7G54-EK box) 
  • Personal computer (Windows®, macOS®, Linux®) running a terminal emulation program 
  • SD memory card (1 GB or larger) 

Prerequisites

Hardware

For this training, you will use the SAMA7G54-EK Evaluation Kit. 

SAMA7G54-EK Evaluation Kit

Setup the SAMA7G54-EK as listed below: 

Jumpers

Power

Back to Top

Download a Demonstration Image

The latest demonstration images for the SAMA7G54-EK are available on the Linux4sam website. There you will find three sets of images created from the following build systems: 

Note that there is one image that can boot from e.MMC Flash Memory and there are three that can boot from SD Memory Card. Download the image of your choice and follow the steps below according to the boot method you have chosen. 

Screen capture of Linux images

Back to Top

Load image onto SD Memory Card

To boot Linux from an SD memory card, perform the following steps.  

If you would like to boot from the onboard e.MMC Flash memory, skip to the next section. 

You will write the image to the SD memory card using the balenEtcher utility program. balenEtcher is a cross-platform utility program used for writing image files onto storage media.  

Select Image

Locate the directory where the image has been stored. There is no need to un-compress the image file. The balenEtcher utility program can handle compressed image files.

Etcher select image


Select Target 

Select the SD memory card. 

Etcher select target


Flash! 

Finally, write the image to the SD memory card. This will take some time, be patient. 

Etcher flash


Insert the SD memory card into slot (J4).

Back to Top

Load Image Into e.MMC Flash Memory

Setup Console Serial Communications

To view the target console, connect to the host computer running a terminal emulation program in accordance with the “SAMA7G54-EK – Console Serial Communications" page.

Setup SAM-BA Host to Monitor Communications

In this section, you will establish SAM-BA host application communications with the target’s (SAMA7G54) SAM-BA Monitor.  

Be certain that the SAM-BA host application has been added to the path. 

To communicate with the SAM-BA monitor on the target, you must 

  • Installed the SAM-BA Host on a Host Computer, and  
  • Connect a micro-B USB cable to the USB-A port (J7) on the SAMA7G54-EK. 

The USB-A port (J7) also functions as a secondary source to power the SAMA7G54-EK. The port is limited to 500 mA. If greater current is required, the SAMA7G54-EK should be powered via J1 (see “Power Options” section on the “SAMA7G54-EK – Features” page.).


Ensure there is no SD memory card inserted in slot J4.

Ensure jumper the DISABLE_BOOT (J22) jumper is open.  

This will allow booting from the onboard memories.  

With no SD memory card installed, the SAMA7G54 will boot to the monitor program. The SD memory card is the default NVM boot memory provided the Boot Configuration Packet has not been written to One-Time Programmable (OTP) memory or emulation memory. 


Press the nSTART (SW3) push button to wake up the MPU. 

The SAMA7G54-EK will boot to the SAM-BA monitor. This action will also activate the USB-A port (J7).  


Observe RomBOOT on the Console (terminal emulator) indicating the SAM-BA Monitor is running on the target device.

Write Image to e.MMC Flash Memory

In this next section, you will write the Linux demonstration image (microchip-headless-image-sama7g5ek-emmc.img) to e.MMC Flash Memory using the SAM-BA In-System Programmer. 

Change the directory to the location of microchip-headless-image-sama7g5ek-emmc.img .

Write microchip-headless-image-sama7g5ek-emmc.img to e.MMC Flash Memory using the following SAM-BA host applet command: 

$ sam-ba -p serial -b sama7g5-ek -a sdmmc -c write: microchip-headless-image-sama7g5ek-emmc.img 

This will take a while to write the image. 

Screen capture of SAM-BA Host writing to e.MMC

Screen capture of console of writing to e.MMC

Back to Top

Enable OTPC Emulation Mode

When prototyping, the One-Time Programmable Memory Controller (OTPC) can be placed into Emulation Mode. Emulation Mode. This allows you to customize the Boot Configuration Packet without having to commit it to One-Time Programmable (OTP) Memory. In this mode, the one-time programmable memory is emulated by OTPC Emulation Memory. 

In production, the Boot Configuration Packet is normally stored in the device’s internal One-Time Programmable (OTP) Memory. 

The OTPC Emulation Memory uses a portion of Secure backup SRAM (SECURAM) located inside the Security Module (SECUMOD) and is powered by VDDBU. Therefore, if the power is removed from the MPU, and VDDBU is available, data will remain. 

The Emulation Mode can only be enabled when OTP Memory has not been previously programmed. 

To place the SAMA7G54 into Emulation Mode, you will use the SAM-BA applet bootconfig’s writecfg command to program the Boot Sequence Control Register (BSCR) to configure the first-stage bootloader (ROM code) to enable the emulation mode before reading the Boot Configuration Packet (BCP). 

For more information on SAM-BA Host Applets, see  

To enable Emulation Mode, perform the following steps: 

Set the Boot Sequence Configuration Register (BSC_CR), Emulation Enable (EMUL_EN) bit to 1: 

$ sam-ba -p serial -b sama7g5-ek -a bootconfig -c writecfg:bscr:EMULATION_ENABLED 

Setting the EMUL_EN bit in the BSC_CR register does not enable the OTPC Emulation Mode immediately. It only tells the first-stage bootloader (ROM code) to enable the OTPC Emulation Mode on the next reset before fetching the Boot Configuration Packet and any other user area packet. 

Screen capture of command window: SAM-BA writecfg bscr emul en

Screen capture of console window: SAM-BA writecfg bscr emul en


Reset Emulation Memory in SECURAM to zero.  

$ sam-ba -p serial -b sama7g5-ek -a bootconfig -c resetemul  

The resetemul command must be called once before any other command accessing SECURAM. 

Screen capture of command window: SAM-BA bootconfig resetemul

Screen capture of console window: SAM-BA bootconfig resetemul


Refresh the Emulation Mode. 

sam-ba -p serial -b sama7g5-ek -a bootconfig -c refreshcfg:emul  

The refreshcfg:emul command tells the OTPC to enable its emulation mode before scanning all packets in the User Area. 

Screen capture of command window bootconfig refreshcfg emul

Screen capture of console window bootconfig refreshcfg emul

The OTPC Emulation Mode is now enabled immediately. It will remain enabled until the next power-on-reset or it has been disabled by the refreshcfg:otp command. 

As SECURAM is powered by VDDBU, data is kept after reset. However, if the value in the BSC_CR register is reset and you will have to reissue the above commands to re-enable emulation mode. 

Back to Top

Set Boot Configuration Packet to boot from e.MMC Flash Memory

In this section, you will configure the Boot Configuration Packet to boot from e.MMC Flash Memory. 

For more information on the Boot Configuration Packet, see Section 19. Boot Strategies in the SAMA7G5 Series Datasheet 

Write boot configuration to boot from e.MMC Flash Memory.  

$ sam-ba -p serial -b sama7g5-ek -a bootconfig -c writecfg:bcp-emul:SDMMC0_IOSET1

Screen capture of command window bootconfig writecfg bcp-emul

Screen capture of console window bootconfig writecfg bcp-emul

Back to Top

Boot

Press the nRST (Reset) push button (SW2). Observe the boot log scrolling on the Console. At the end, the command line will prompt the user to log in. Log in as ‘root.’ There is no password required. 

Log in for the sama7g5ek-emmc headless image: 

Screen capture of console showing Linux login

Observe the RGB LED flashing blue (heartbeat). 

Congratulations! Booting of the demo Linux image on the SAMA7G54-EK is complete. 

Back to Top

Summary

In this training, you booted a demonstration Linux image to the SAMA7G54-EK Evaluation Kit using one of two methods, SD memory card or onboard e.MMC Flash Memory. 

Back to Top

Learn More

Back to Top