Update NuWriter material.
1. DDR timing setting. 2. README.md 3. Remove unused files.
This commit is contained in:
parent
2d15f10385
commit
d0b70ab753
|
@ -21,16 +21,24 @@ Step 2: Copy MS64\dll\libusb-1.0.dll to C:\Windows\System32.
|
|||
Step 3: Copy MS64\dll\libusb-1.0.lib to C:\Users\<user name>\AppData\Local\Programs\Python\<python ver>\Lib.
|
||||
```
|
||||
|
||||
## Scripts
|
||||
## Double-click Scripts for Windows
|
||||
|
||||
### nuwriter_ddr_download_and_run.bat
|
||||
|
||||
Download rttthread binary file into DDR. The address is 0x80400000.
|
||||
Download rtthread.bin binary file into DDR. The address is 0x80400000.
|
||||
|
||||
### nuwriter_nand_programming.bat
|
||||
### nuwriter_sd_programming.bat
|
||||
|
||||
Program header, DDR timing setting and rttthread binary file into NAND flash.
|
||||
Program header, DDR timing setting and rtthread.bin binary file into SD card or EMMC.
|
||||
|
||||
### nuwriter_spinand_programming.bat
|
||||
|
||||
Program header, DDR timing setting and rttthread binary file into SPI NAND flash.
|
||||
Program header, DDR timing setting and rtthread.bin binary file into SPI NAND flash.
|
||||
|
||||
### nuwriter_nand_programming.bat
|
||||
|
||||
Program header, DDR timing setting and rtthread.bin binary file into NAND flash.
|
||||
|
||||
|
||||
### See also
|
||||
[NuWriter Repository](https://github.com/OpenNuvoton/MA35D1_NuWriter)
|
||||
|
|
|
@ -8,7 +8,7 @@ import crcmod
|
|||
|
||||
class UnpackImage:
|
||||
|
||||
def __init__(self, pack_file_name):
|
||||
def __init__(self, pack_file_name, nocrc):
|
||||
self.img_list = []
|
||||
try:
|
||||
with open(pack_file_name, "rb") as pack_file:
|
||||
|
@ -21,11 +21,14 @@ class UnpackImage:
|
|||
print(f"{pack_file_name} marker check failed")
|
||||
sys.exit(0)
|
||||
|
||||
crc32_func = crcmod.predefined.mkCrcFun('crc-32')
|
||||
checksum = crc32_func(self.pack_data[8:])
|
||||
if checksum != int.from_bytes(self.pack_data[4:8], byteorder='little'):
|
||||
print(f"{pack_file_name} CRC check failed")
|
||||
sys.exit(0)
|
||||
print("Waiting for unpack Images ...")
|
||||
if nocrc == 0:
|
||||
print("check pack file crc32 ...")
|
||||
crc32_func = crcmod.predefined.mkCrcFun('crc-32')
|
||||
checksum = crc32_func(self.pack_data[8:])
|
||||
if checksum != int.from_bytes(self.pack_data[4:8], byteorder='little'):
|
||||
print(f"{pack_file_name} CRC check failed")
|
||||
sys.exit(0)
|
||||
self.image_cnt = int.from_bytes(self.pack_data[8:12], byteorder='little')
|
||||
# 1st image descriptor begins @ 0x10
|
||||
index = 0x10
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
py -3 nuwriter.py -c header-nand.json
|
||||
pause
|
|
@ -1,2 +0,0 @@
|
|||
py -3 nuwriter.py -p pack-nand.json
|
||||
pause
|
Binary file not shown.
Binary file not shown.
|
@ -63,6 +63,7 @@ OPT_STUFF = 7 # For stuff pack, output could be used by dd command
|
|||
OPT_SETINFO = 8 # For set storage info for attach
|
||||
OPT_CONCAT = 9 # For convert, concatenate at the end of encrypted data file
|
||||
OPT_SHOWHDR = 10 # For convert. Instead of convert, show header content instead
|
||||
OPT_NOCRC = 11 # For pack. unpack file without crc32 check
|
||||
OPT_UNKNOWN = 0xFF # Error
|
||||
|
||||
|
||||
|
@ -765,7 +766,7 @@ def do_pack_program(media, pack_file_name, option=OPT_NONE) -> None:
|
|||
print("Device not found")
|
||||
sys.exit(2)
|
||||
|
||||
pack_image = UnpackImage(pack_file_name)
|
||||
pack_image = UnpackImage(pack_file_name, option)
|
||||
with ThreadPoolExecutor(max_workers=8) as executor:
|
||||
futures = [executor.submit(__pack_program, dev, media, pack_image, option) for dev in devices]
|
||||
success = 0
|
||||
|
@ -1179,10 +1180,10 @@ def do_attach(ini_file_name, option=OPT_NONE) -> None:
|
|||
print(f"Successfully get info from {success} device(s)")
|
||||
|
||||
|
||||
def do_unpack(pack_file_name) -> None:
|
||||
def do_unpack(pack_file_name, nocrc32) -> None:
|
||||
|
||||
now = datetime.now()
|
||||
pack_image = UnpackImage(pack_file_name)
|
||||
pack_image = UnpackImage(pack_file_name, nocrc32)
|
||||
image_cnt = pack_image.img_count()
|
||||
|
||||
try:
|
||||
|
@ -1681,7 +1682,8 @@ def get_option(option) -> int:
|
|||
'STUFF': OPT_STUFF,
|
||||
'SETINFO': OPT_SETINFO,
|
||||
'CONCAT': OPT_CONCAT,
|
||||
'SHOWHDR': OPT_SHOWHDR
|
||||
'SHOWHDR': OPT_SHOWHDR,
|
||||
'NOCRC': OPT_NOCRC
|
||||
}.get(option, OPT_UNKNOWN)
|
||||
|
||||
|
||||
|
@ -1772,7 +1774,9 @@ def main():
|
|||
sys.exit(0)
|
||||
else:
|
||||
if option == OPT_UNPACK:
|
||||
do_unpack(cfg_file)
|
||||
do_unpack(cfg_file, 0)
|
||||
elif option == OPT_NOCRC:
|
||||
do_unpack(cfg_file, 1)
|
||||
elif option == OPT_STUFF:
|
||||
do_stuff(cfg_file)
|
||||
else:
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
:forever_develop
|
||||
py -3 nuwriter.py -a ddrimg\enc_ddr3_winbond_256mb.bin
|
||||
IF %ERRORLEVEL% EQU 0 (
|
||||
py -3 nuwriter.py -o execute -w ddr 0x28000000 ..\preload\leave_ibr.bin
|
||||
)
|
||||
pause
|
||||
|
||||
goto :forever_develop
|
|
@ -1,5 +0,0 @@
|
|||
py -3 nuwriter.py -c header-sram-leave_ibr.json
|
||||
IF %ERRORLEVEL% EQU 0 (
|
||||
py -3 nuwriter.py -p pack-sd-leave_ibr.json -o stuff
|
||||
)
|
||||
pause
|
Binary file not shown.
Binary file not shown.
|
@ -1,69 +0,0 @@
|
|||
TARGET ?= leave_ibr
|
||||
|
||||
#################################
|
||||
# GNU ARM Embedded Toolchain
|
||||
#################################
|
||||
CC=aarch64-elf-gcc
|
||||
CXX=aarch64-elf-g++
|
||||
LD=aarch64-elf-ld
|
||||
AR=aarch64-elf-ar
|
||||
AS=aarch64-elf-as
|
||||
CP=aarch64-elf-objcopy
|
||||
OD=aarch64-elf-objdump
|
||||
NM=aarch64-elf-nm
|
||||
SIZE=aarch64-elf-size
|
||||
A2L=aarch64-elf-addr2line
|
||||
|
||||
#################################
|
||||
# Working directories
|
||||
#################################
|
||||
ROOT = .
|
||||
|
||||
#################################
|
||||
# Source Files
|
||||
#################################
|
||||
|
||||
# Search path and source files for the ST stdperiph library
|
||||
|
||||
ASMSOURCES = $(notdir $(wildcard *.ASM))
|
||||
|
||||
INCLUDE_DIRS = -I$(ROOT)
|
||||
|
||||
#################################
|
||||
# Object List
|
||||
#################################
|
||||
OBJECTS=
|
||||
|
||||
#################################
|
||||
# Target Output Files
|
||||
#################################
|
||||
TARGET_O=$(TARGET).o
|
||||
TARGET_ASM=$(TARGET).asm
|
||||
|
||||
#################################
|
||||
# Flags
|
||||
#################################
|
||||
MCFLAGS=-march=armv8-a
|
||||
OPTIMIZE = -O2
|
||||
AFLAGS=-c $(MCFLAGS) -x assembler-with-cpp -D__ASSEMBLY__
|
||||
LDSCRIPT=
|
||||
LDFLAGS = -nostartfiles -Wl,--gc-sections,-cref,-Map=$(TARGET).map,-cref,-u,_start -T $(TARGET).ld
|
||||
|
||||
#################################
|
||||
# Build
|
||||
#################################
|
||||
all: clean $(TARGET_O)
|
||||
|
||||
$(TARGET_O):
|
||||
@echo -n "Build $@ ..."
|
||||
$(CC) -c $(INCLUDE_DIRS) $(AFLAGS) $(ASMSOURCES) $(LDFLAGS)
|
||||
$(OD) -d $@ > $(TARGET).txt
|
||||
$(CP) -O binary $(TARGET_O) ../nuwriter_scripts/$(TARGET).bin
|
||||
|
||||
#################################
|
||||
# Recipes
|
||||
#################################
|
||||
.PHONY: all clean
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET_O)
|
|
@ -5,5 +5,3 @@
|
|||
|
||||
make
|
||||
python transcode.py
|
||||
|
||||
make -f Makefile.leave_ibr
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Date Author Notes
|
||||
* 2021-06-29 Wayne the first version
|
||||
*
|
||||
* Description: Load the routine into SRAM0 0x28000000
|
||||
*
|
||||
*/
|
||||
|
||||
.section ".text.boot"
|
||||
.global _start
|
||||
|
||||
_start:
|
||||
/* Give execution address for secondary CPU */
|
||||
adr x20, .
|
||||
|
||||
/*=============================================================*/
|
||||
/* Read CPU id */
|
||||
/* Primary core(id=0): Help Secondary core leaving. */
|
||||
/* Secondary core(id>0): Notice 'Ready' to Primary core. */
|
||||
/*=============================================================*/
|
||||
/* MPIDR_EL1: Multi-Processor Affinity Register */
|
||||
mrs x1, mpidr_el1
|
||||
and x1, x1, #3
|
||||
cbz x1, .L__cpu_0_loop
|
||||
|
||||
.L__cpu_1_loop:
|
||||
/*=============================================================*/
|
||||
/* Secondary CPU notification */
|
||||
/*=============================================================*/
|
||||
wfe /* Wait for Primary CPU's notification */
|
||||
|
||||
mov x0, #0x48 /* if (*(0x40460048)==PC) */
|
||||
movk x0, #0x4046, LSL #16 /* goto L__cpu_1_loop */
|
||||
ldr x1, [x0] /* else */
|
||||
cmp x1, x20 /* goto *(0x40460048) */
|
||||
b.eq .L__cpu_1_loop
|
||||
br x1
|
||||
|
||||
.L__cpu_0_loop:
|
||||
/*=============================================================*/
|
||||
/* Help CPU-1 to leave IBR. */
|
||||
/*=============================================================*/
|
||||
mov x0, #0x48 /* *(0x40460048) = _start */
|
||||
movk x0, #0x4046, LSL #16
|
||||
mov x1, x20
|
||||
str w1, [x0]
|
||||
sev /* Wakeup Secondary CPU */
|
||||
b .L__cpu_0_loop
|
||||
|
Loading…
Reference in New Issue