In this section, we shall describe the way to build, download and execute SH7264RSK solution available in the porting kit with Serial Flash Memory.
Since the Serial Flash Memory doesn’t have XiP(execute-in-place) capability, CPU need to copy program data from Serial Flash Memory to Internal RAM and execute from RAM.
To copy data from the Serial Flash memory to the Internal RAM automatically, the loader program is required.The loader program is named “sh7264_sflash_loader_prog.abs” in the E10A-USB workspace.
For detail for how to use the Serial Flash memory, refer the application note about “Boot from the Serial Flash Memory”. This application note and sample source code can be downloaded from Renesas Web Site.
Please note, we modified the source code of sh7264_sflash_loader_prog.abs little bit to suitable for .NET Micro Framework. The modified source code is in the sh7264_sflash_downloader_for_NETMF.zip.
5.1 How to Build
1) Using Command-line prompt, change the directory to “Solutions\SH7264_RSK”
Msbuild dotnetmf.proj /t:build /p:flavor=debug;SERIALFLASH=true;EnableTcpIp=true;TCP_IP_STACK=LWIP
SERIALFLASH : <ture|false>
EnableTcpIp : <ture|false>
TCP_IP_STACK : LWIP If you want to use RTIP, don’t need to add TCP_IP_STACK.
If you want to debug your program using E10A-USB Emulator, please specify “debug” for “flavor” option.
In this case, specify SERIALFLASH to “true”.
If you want to use LCD panel instead of VOU output, please modify below code before execute “Msbuild”.
File name : C:\MicroFrameworkPK_v4_1\DeviceCode\Targets\Native\SH7264\DeviceCode\VDC3\SH7264_VDC3.h
5.2 Board switch settings
Set SW1 of the SH7264 RSK board as below to startup from NOR Flash.
Boot the MCU, through high-speed communication, from the 8MB serial flash memory connected to the channel 0 of SPI interface.
EXTAL or crystal resonator
It should be keep ON
It should be keep ON
In addition, JP1 should be shorted.
Figure 5.1 SW5 settings
5.3 Download using E10A-USB
1) Setup the E10A-USB Emulator
Install the E10A-USB Emulator software into your PC.
During install, you should select the device group for E10A-USB then specify “Super H RISC engine family SH-2A device group”
2) How to start downloading using E10A-USB
Extract the HEW workspace for SH7264 RSK Porting Kit from file SH7264RSK.zip at any place in your PC.
In the following instructions, we will assume it is installed in “c:\workspace”
Start the Hew with choosing below menu
Figure 5.2 Hew menu
Then Hew will be show up and you can see below dialog box.
Specify the workspace as below, and press OK button.
Figure 5.3 Welcome dialog box
In below dialog box, set options like below.
Figure 5.3 Select Emulator mode dialog box
When below message shows up, reset the target board by pressing the reset button on the board and then press OK button.
Figure 5.4 Heush2acustom1 dialog box
Then Hew/E10A-USB will finish connection with SH7264.
Figure 5.5 Hew window
3) How to download the program to the flash memory
i) Prepare the download module.
Select the [Debug] -> [Debug Settings…] from the menu bar of Hew then below dialog box will show up.
Figure 5.6 Debug Settings dialog box
Here is the definition of download modules. Please change the Path setting for each download module by clicking “Modify” button.
In the case of downloading TinyCLR, additional one file needs to be downloaded.
Figure 5.7 Download Modules dialog box
Press [Add…] button so the [Download Module] dialog box shows up. Then press [Browse…] button.
Figure 5.8 Select Download Module
In this dialog
box, select C:\MicroFrameworkPK_v4_1\BuildOutput\SH2A\SHC9.2\Be\FLASH\<option>\SH7264_RSK\bin\tinyclr.dat
In the next step, specify [File format:] to “Binary”.
Figure 5.9 Download Module dialog box
In addition, [Offset:] should be changed.
Figure 5.10 Download Module dialog box
The offset is decided from the definition in Scatterfile_definition.proj file.
To know the offset, open C:\MicroFrameworkPK_v4_1\Solutions\SH7264_RSK\TinyCLR\Scatterfile_definition.proj
<!-- A simple scatterfile for SH -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<PropertyGroup Condition="'$(SERIALFLASH)'!='true' ">
<PropertyGroup Condition="'$(SERIALFLASH)'=='true' ">
Offset = This value + 0x1c000000 -
Offset = This value + 0x1c000000 - 0x2000
ii) Prepare for downloading to Flash Memory.
Select the [Setup] -> [Emulator] -> [System…] from the menu bar of Hew then “Configuration” dialog box will show up.
Select “Loading flash memory” tab. Then, specify as same as below figure.
Figure 5.11 Configuration dialog box
iii) Download module to RAM temporary
Figure 5.12 Hew window
In order to download, double click on the name of the download module which you want to download to RAM.
In the case of downloading TinyCLR, download both of TinyCLR.abs and tinyclr.dat. In the case of downloading NativeSample, download only nativesample.abs.
iv) Specify and Run the Batch file to write data to Serial Flash Memory.
In order to download data to Serial flash, the batch file should be executed.
· Specify the batch file
Figure 5.13 Popup menu on Command Line window
On the command line window, do the right clicking so that the popup menu shows up.
Select “Set Batch file…” and specify the batch file name like the figure in next page,
Figure 5.14 Select Batch File
· Run the batch file
After specify the batch file, please press “Play” button so that batch file starts to run. During running the batch file, following dialog box might be opened several times.
Figure 5.15 Open dialog box
Press “Cancel” button.
After several seconds or minutes, the program will be stop.
Figure 5.16 Hew window
If the program stops by red portion, the download to Serial Flash is finished properly.
If the program stops by blue portion, the download to Serial Flash is not finished properly.
3) How to copy the program from Serial Flash to Internal RAM and run
In order to copy program and run, you just simply need to press the [Reset Go] button.
Figure 5.17 Reset Go button
Please push the reset button after
pressing “Reset Go” for proper initialization of LCD panel
Please push the reset button after pressing “Reset Go” for proper initialization of LCD panel