You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Here are steps for how to program the secondary bootloader application into onboard SPIFlash(Take EMSK2.3 - ARC EM7D as example) and automatically load and run *boot.hex* or *boot.bin* in SDCard.
69
-
* - Generate a secondary bootloader binary file
70
-
* + cd <embARC>/example/baremetal/bootloader
71
-
* + Generate binary file: make TOOLCHAIN=gnu BD_VER=23 CUR_CORE=arcem7d bin
72
-
* - If the binary file is generated successfully, you will output as follows:
* - Program generated secondary bootloader binary file into SPIFlash
99
-
* + Insert SDCard to your PC, and copy the binary file *obj_emsk_23/gnu_arcem7d/emsk_bootloader_gnu_arcem7d.bin* to SDCard Root, and rename it to *em7d_2bt.bin*
100
-
* + Insert the SDCard to EMSK Board, please choose the right core configuration, build and run the <em><embARC>/example/baremetal/bootloader</em> example,
101
-
* then press any button to stop auto boot process, and enter to ntshell command mode.
102
-
* + Then use ntshell command *spirw* to program the *em7d_2bt.bin* into spiflash.
103
-
* - Firstly, run *spirw* to show help
104
-
* - Secondly, run *spirw -i* to check SPIFlash ID, it should be **Device ID = ef4018**
105
-
* - Thirdly, run *spirw -w em7d_2bt.bin 0x17f00000 0x17f00004* to program spiflash
106
-
* - Check the output message to see if if was programmed successfully.
107
-
* - 
108
-
* + If programmed successfully, when the board is reset, make sure Bit 4 of the onboard DIP switch is ON to enable secondary bootloader run.
109
-
* + If the sdcard already contains the *boot.bin* in it, the bootloader will automatically load it from sdcard, if not, it will enter to ntshell mode.
110
-
* + You can goto the next step to generate the *boot.bin* for proper application you want to be auto-loaded in sdcard.
111
-
* 
112
-
* - Generate *boot.bin* using any embARC example which ram start address should be 0x10000000 and use bootloader to run it
113
-
* + Here take <em><embARC>/example/freertos/kernel</em> for example
* + Insert SDCard to PC, and copy generated binary file *obj_emsk_23/gnu_arcem7d/freertos_kernel_gnu_arcem7d.bin* to SDCard Root, and rename it to boot.bin
117
-
* + Insert SDCard back to EMSK, make sure bit 4 of DIP Switch is ON, and press re-configure button above letter **C**, and wait for autoload.
118
-
* + 
119
-
* - Know Issues
120
-
* + Bootrom of EMSK1.x is not able to load secondary bootloader on SPIFlash, you need a modified EMSK1.x mcs file to enable this function, please send request in forum about this mcs file.
121
-
*
122
-
* **The secondary bootloader is a complement of the primary bootloader, and provides the following functions:**
123
-
* - File operations on SD card
124
-
* - Operations on the EMSK, GPIO, I2C, SPI flash
125
-
* - Operations on ARC processors
126
-
* - Automatic boot from SD card, using following instructions:
127
-
* + burn the bin file of bootloader into EMSK spiflash using spirw command <b>spirw -w bootloader.bin 0x17f00000 0x17f00004 </b> with the help of JTAG
128
-
* + the primary bootloader should be able to load the secondary bootloader
129
-
* + put the file you want to boot in the root directory of SD card, name it boot.bin
130
-
* + plug in SD card
131
-
* - LED Status of loading application(boot.bin)
132
-
* + Start to load application: LED on board -> 0x0F
133
-
* + Load application finished: LED on board -> 0xFF, if application is running normally, LED will quickly change to 0x0
134
-
* + Load application failed: LED on board -> 0xAA
135
-
* + Skip loading application, and enter to NTShell runtime: LED on board -> 0x0
136
-
* - Type *help* command in ntshell to show the list of supported commands.
137
-
*
138
-
* 
139
-
*
140
-
* ### Extra Comments
141
-
* - Bootrom of EMSK1.x is not able to load secondary bootloader on SPIFlash, you need a modified EMSK1.x mcs file to enable this function, please send request in forum about this mcs file.
142
-
* - Make sure that the bootloader can only load application for extract the same core you built for.
143
-
* - Currently the 2nd bootloader ran in a different place(end of DDR) in DDR which has no conflict with other normal examples placed at start of DDR.
144
-
* - Bootloader example only support arc core configuration which has DDR with cache enabled.
145
-
* - Bootloader example runs in DDR ram, not in CCM.
146
-
* - Bootloader example itself can be treated as a ntshell example, you can run some ntshell commands using this example.
147
-
* - The bootloader example is also built optimized for the ARC core you selected, so the example built for one specified core may not run sucessfully for another core configuration.
148
-
* - Supported core configurations
149
-
* + EMSK 1.1: EM6, EM6GP
150
-
* + EMSK 2.2/2.3: EM7D, EM11D
151
-
*/
152
-
153
-
/**
154
-
* \file
155
-
* \ingroup EMBARC_APP_BAREMETAL_BOOTLOADER
156
-
* \brief example of secondary bootloader after the bootrom of EMSK
157
-
* \todo
158
-
*/
159
-
160
-
/**
161
-
* \addtogroup EMBARC_APP_BAREMETAL_BOOTLOADER
162
-
* @{
163
-
*/
164
-
165
31
#include"embARC.h"
166
32
#include"embARC_debug.h"
167
33
168
34
#include"ntshell_common.h"
169
35
#include"ihex_load.h"
170
36
#include"parson.h"
171
37
38
+
#include"target_mem_config.h"
39
+
172
40
#defineBOOT_CFG_FILE_NAME "boot.json"
173
41
#defineBOOT_FILE_NAME "0:\\boot.bin" /*!< default autoload full file name */
42
+
43
+
#if defined(BOARD_EMSK)
174
44
#defineRAM_STARTADDRESS 0x10000000 /*!< default ram start address of boot.bin */
175
45
#defineAPP_CFG_ADDR 0x17f00000 /*!< save the app configuration file name */
46
+
#elif defined(BOARD_IOTDK)
47
+
#defineRAM_STARTADDRESS EXT_RAM_START
48
+
#defineAPP_CFG_ADDR ARC_X_MEM_START
49
+
#endif
50
+
176
51
#definePROMT_DELAY_S (5) /*!< default wait time for autoload */
0 commit comments