1# **nuwriter_scripts** 2 3Some scripts can help you program firmware into storages in this folder. 4 5## **Requirement** 6 7### [Python3 for Window](https://www.python.org/downloads/windows/) 8 9After installing Python3, some plug-in as below must be installed. 10 11```bash 12pip3 install pyusb usb crypto ecdsa crcmod tqdm pycryptodome 13``` 14 15Notice: 16 17- Tested python3 version is 3.10.1. 18- Please remember to add Python to PATH environment variable. 19 20### [Libusb for Window](http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download) 21 22On Windows platform, it is required to install libusb manually. 23 24```bash 25Step 1: Download the library extract the download file. 26Step 2: Copy MS64\dll\libusb-1.0.dll to C:\Windows\System32. 27Step 3: Copy MS64\dll\libusb-1.0.lib to C:\Users\<user name>\AppData\Local\Programs\Python\<python ver>\Lib. 28``` 29 30### [USB Driver for Window](https://github.com/OpenNuvoton/MA35D1_NuWriter/blob/master/driver/WinUSB4NuVCOM.exe?raw=true) 31 32NuWriter must install **WinUSB4NuVCOM.exe** on the computer. 33 34## **Double-click Scripts for Windows** 35 36If your NuWriter_MA35 python running is ready, you can do following batch script files for Window directly. 37 38### **nuwriter_ddr_download_and_run.bat** 39 40Download rtthread.bin binary file into DDR. The address is 0x80400000. 41 42### **nuwriter_sd_programming.bat** 43 44Program header, DDR timing setting and rtthread.bin binary file into SD card or EMMC. 45 46### **nuwriter_spinand_programming.bat** 47 48Program header, DDR timing setting and rtthread.bin binary file into SPI NAND flash. 49 50### **nuwriter_nand_programming.bat** 51 52Program header, DDR timing setting and rtthread.bin binary file into NAND flash. 53 54 55## **Bash Scripts for Linux** 56 57If your NuWriter_MA35 python running is ready, you can do following bash script files for Linux directly. 58If not, the **install_linux.sh** will help user to install related python module installation. 59 60```bash 61# ./install_linux.sh 62``` 63 64### **nuwriter_ddr_download_and_run.sh** 65 66Download rtthread.bin binary file into DDR. The address is 0x80400000. 67 68### **nuwriter_sd_programming.sh** 69 70Program header, DDR timing setting and rtthread.bin binary file into SD card or EMMC. 71 72### **nuwriter_spinand_programming.sh** 73 74Program header, DDR timing setting and rtthread.bin binary file into SPI NAND flash. 75 76### **nuwriter_nand_programming.sh** 77 78Program header, DDR timing setting and rtthread.bin binary file into NAND flash. 79 80 81## **Troubleshoot** 82 83### **Fail to create symbolic folder** 84 85```bash 86Create symbolic folder conv failed 87``` 88 89- To switch **Developer Mode** in Window. To enter [Settings], [Update & Security], [For developers], [Developer Mode] page, then set it **On** 90- Use **Administrator** permission to install python3, libusb and utilities. 91 92### **Use NuWriter_MA35.exe** 93 94Due to the python execution file size and saving network bandwidth, we just only release the python code in this repository. We also provide [NuWriter_MA35.exe](https://github.com/OpenNuvoton/MA35D1_NuWriter/blob/master/EXE/NuWriter_MA35.exe?raw=true) python execution. You can run the packaged app without installing a Python interpreter or any modules. You can use **NuWriter_MA35.exe** and do some modification. 95 96```bash 97To modify "py -3 nuwriter.py" to "NuWriter_MA35.exe" 98``` 99 100For example, the **nuwriter_ddr_download_and_run.bat** modification is as following: 101 102```bash 103:forever_develop 104NuWriter_MA35.exe -a ddrimg\enc_ddr3_winbond_256mb.bin 105IF %ERRORLEVEL% EQU 0 ( 106 NuWriter_MA35.exe -o execute -w ddr 0x80400000 ..\rtthread.bin 107) 108pause 109goto :forever_develop 110``` 111 112## **See also** 113 114[NuWriter Repository](https://github.com/OpenNuvoton/MA35D1_NuWriter) 115