5. The case of using limitedfunctions with Serial Flash memory and Internal RAM

SH7264 M3A-HS64 NETMF

5.    The case of using limited functions with Serial Flash memory and Internal RAM

 In this section, we shall describe the way to build, download and execute SH7264 M3A-HS64G50 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_M3A_HS64”

    C:\MicroFrameworkPK_v4_1>cd solutions\SH7264_M3A_HS64

2) Run

    Msbuild dotnetmf.proj /t:build /p:flavor=debug;SERIALFLASH=true

      Flavor: <debug|release|rtm>       SERIALFLASH : <ture|false>

      If you want to debug your program using E10A-USB Emulator, please specify “debug” for “flavor” option.

      In this case, specify SERIALFLASH to “true”.

 


5.2                Board switch settings

There are two DIP switches located on the CPU board. The function of each switch and its connection are shown below:

Figure 5.1   SW5 settings

Figure 5.2   SW6 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 M3A-HS64G50 Porting Kit from file SH7264M3AHS64.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.1   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.2   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_M3A_HS64\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_M3A_HS64\TinyCLR\Scatterfile_definition.proj

 


<!-- A simple scatterfile for SH -->

<Project  xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >

<PropertyGroup Condition="'$(SERIALFLASH)'!='true' ">

    <ER_PROG_ADDR>20000</ER_PROG_ADDR>

    <ER_DATA_ADDR>20200000</ER_DATA_ADDR>

    <ER_CONFIG_ADDR>203F0000</ER_CONFIG_ADDR>

    <ER_INIT_LOAD>0100000</ER_INIT_LOAD>

    <ER_INIT_EXEC>0c000000</ER_INIT_EXEC>

    <ER_RW_ADDR>0C010000</ER_RW_ADDR>

    <ER_VTR_ADDR>00</ER_VTR_ADDR>

    <ER_PReset_ADDR>20001000</ER_PReset_ADDR>

    <STACK_ADDR>0c06fff8</STACK_ADDR>

    <HEAP_ADDR>0c200000</HEAP_ADDR>

    <HEAP_END>0c5fffff</HEAP_END>

    <PROG_RAM_ADDR>0c100000</PROG_RAM_ADDR>

    <PROG_RAM_END>0c10fff8</PROG_RAM_END>

    <ENTRY_ADDR></ENTRY_ADDR>

</PropertyGroup>

 

<PropertyGroup Condition="'$(SERIALFLASH)'=='true' ">

  <ER_PROG_ADDR>1c001100</ER_PROG_ADDR>

  <ER_DATA_ADDR>000b2000</ER_DATA_ADDR>

  <ER_CONFIG_ADDR>1c0ad000</ER_CONFIG_ADDR>

  <ER_INIT_LOAD>1c0ada00</ER_INIT_LOAD>

Offset = This value + 0x1c000000 – 0x2000

 

 
  <ER_INIT_EXEC></ER_INIT_EXEC>

  <ER_RW_ADDR>FFF80000</ER_RW_ADDR>

  <ER_VTR_ADDR>1C000000</ER_VTR_ADDR>

  <ER_PReset_ADDR>1C000E00</ER_PReset_ADDR>

  <STACK_ADDR>fff88800</STACK_ADDR>

  <HEAP_ADDR>1c0ae800</HEAP_ADDR>

  <HEAP_END>1c0dc3FC</HEAP_END>

  <ENTRY_ADDR></ENTRY_ADDR>

</PropertyGroup>

 

</Project>


 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

   Sepcify …\sflash_boot\downloader.hdc.

·         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