Development Guide of DWIN OS Platform Based On T5L CPU12.15
Development Guide of DWIN OS Platform Based On T5L CPU12.15
Contents
1. DWIN OS Platform Structure ........................................................................................................................ 2
2. DWIN OS Debugging Port(UART2) ....................................................................................................... 4
3. Storage Space ................................................................................................................................................ 5
3.1 Users Data Library ....................................................................................................................................... 5
3.2 Data Variable Space .................................................................................................................................... 5
3.3 Register.......................................................................................................................................................... 6
3.4 Port Register ................................................................................................................................................. 6
4. DWIN OS Assembly Instruction Set ............................................................................................................ 9
4.1 Data Exchange ............................................................................................................................................. 9
4.2 Computation ................................................................................................................................................ 10
4.3 Logic Operation .......................................................................................................................................... 12
4.4 Data Processing ......................................................................................................................................... 12
4.5 Process Controlling .................................................................................................................................... 14
4.6 Peripheral Operation .................................................................................................................................. 15
5. Appendix ........................................................................................................................................................ 17
0x0000-0x0FFF L2_Cache The space of program dynamically loads and calls, 4KB.
The start address of program operating when reset, place one GOTO command to
0x1000 RESET
jump to the main program.
(2) The max nested call of subroutine including interrupted program, up to grade 127.
ORG 1000H
GOTO MAIN
; The first command must GOTO.
GOTO T0INT ; When interrupt, jumping to T0 to interrupting program, must use
GOTO, can not use CALL.
NOP ; T1 Discontinuity not be used.
GOTO T2INT ; Discontinuity produces, jumping to T2 to interrupting service
program.
ORG 1080H
MAIN: NOP ; Main program
GOTO MAIN
If interrupts were not adopted(closed the interrupt), the code space of 0x1004-0x107F could be
used at will.
If the main program is needed to operate breakpoint simulation, the interrupt shall be closed.
otherwise, the timer keeps running under simulation status, opening interrupt would cause the main
program to fail operating breakpoint simulation.
Data 1 2 3 4 5
Example
(without 5A A5 04 83 00 10 04
check)
Example
(with check) 5A A5 06 83 00 10 04 25 A3
DR0-DR255
0x08 Port Register Details in DWIN OS development guide basing on T5L, 3.4 port register definition
description.
3.Storage Space
3.1Users Data Library
Include two parts:
(1) The flash in the T5L chip can be accessed by system variable interface and all DWIN OS based on
T5 can be supported.
(2) A large database or data store located on an off-chip flash, accessed through a system variable
interface, depending on the hardware platform.
At all DWIN OS platform based on T5L CPU, the first 16-word definition of system variable port is
unified, shown as follows:
0x00 Reserve 4
D3: 0x5A first updates DWIN OS program(inserting into ram Flash), clearing after CPU
operation finish.
0x06 OS_Update_CMD 2 D2: Fixing as 0x10, DWIN OS code should be start from 0x1000.
D1: 0:The initial data variation space address of store-and-update code 0x1000-
0x0C7E should be even.
D7: operation mode 0x5A=read 0xA5=write, clearing after CPU operation finished.
D6: 4: the initial address of ram Nor Flash data base should be even. 0x000000-0x02:
NOR_
0x08 4 FFFE, 256KWords.
Flash_RW_CMD
D3: 2: the initial data variation space address should be even.
D1: 0: the length of read and write word should be even.
D3=0x5A means UART2 serial mode setting, only used for GUI CPU setting, UART2
UART2_Set mode after reset, OS can not operate itself.
0x0C 2
D2=serial mode, 0x00=8N1.
D1: D0=baud rate value, baud rate value=3225600/set baud rate.
0x0E Reserve 1
3.3 Register
DWIN OS based on T5L has a total of 2048 registers, divided into 8 pages for access, each page has
256 registers, corresponding to R0-R255.
16 1 R UART3_TTL_Status
17 1 R UART3_TTL_Status
Serial received frame overtime timer status:
18 1 R UART4_TTL_Status 0x00= received frame overtime timer overflowing others=no overflowing.
It should be done first that applying RDXLEN command reads received length,
19 1 R UART5_TTL_Status when length is not 0, then checking overtime timer status.
20 1 R UART6_TTL_Status
20 1 R UART7_TTL_Status
21 1 -- Reserve
27 1 -- Reserve
UART3 the time of received frame overtime timer. Unit 0.5mS, 0x01-0xff,
28 1 R/W UART3_TTL_SET
power-on set as 0x0A.
UART4 the time of received frame overtime timer. Unit 0.5mS, 0x01-0xff,
29 1 R/W UART4_TTL_SET
power-on set as 0x0A.
UART6 the time of received frame overtime timer. Unit 0.5mS, 0x01-0xff,
31 1 R/W UART6_TTL_SET
power-on set as 0x0A.
UART7 the time of received frame overtime timer. Unit 0.5mS, 0x01-0xff,
32 1 R/W UART7_TTL_SET
power-on set as 0x0A.
33 1 -- Reserve
70 9 -- Reserve
132 2 R/W CNT0 CNT0 changing counting value, resetting to 0x0000 when counting to 0xFFFF.
134 2 R/W CNT1 CNT1 changing counting value, resetting to 0x0000 when counting to 0xFFFF.
136 2 R/W CNT2 CNT2 changing counting value, resetting to 0x0000 when counting to 0xFFFF.
138 2 R/W CNT3 CNT3 changing counting value, resetting to 0x0000 when counting to 0xFFFF.
DWIN OS register R0-R255 Byte 2048 Bytes Divided into 8 pages, control page by DR0 port register.
Data variable space XRAM Word 64K Words Range of address: 0x0000-0xFFFF
Depend on
User data library LIB Word
hardware
(7) When T5L CPU runs at the speed of 200MHz, the average operating time of one DWIN OS
command is about 125nS (8MIPS).
4.1Data Exchange
Command Function Code Number Description
R#:Register or Register group.
<MOD>: 0=Register to variable 1=Variable to register.
Data exchange
R#, <MOD>, <NUM>: exchange data word(Word)length, 0x00-0x80;
between Variables & MOVXR
<NUM> When<NUM>is 0x00, data length depends on R9.
Registers
Data variable pointer is defined by R0: R1 register.
MOVXR R20, 0, 2
R#: Register or Register group.
Load N 8bit
R#, <DATA>, <DATA>: Data need loading.
Immediate number to LDBR
<NUM> <NUM>: Number of Register need loading, 0x00 means 256.
register group
LDBR R8, 0x82, 3
R#: Register group.
Load 1 16 bit <DATA>: Number of that loading
LDWR R#, <DATA>
numbers to Registers LDWR R8,1000.
LDWR R8, -300
Load address code Load <Address> to R5: R6: R7 LDADR TAB
LDADR <Address>
space LDADR 0x123456
Save the <NUM> register data starting with R# to the data stack.
PUSH R#<NUM>
PUSH R8, 4
Register stack
256 bytes
Fetch data from the data stack to the <NUM> registers starting with R#.
POP R#<NUM>
POP R8, 4
4.2 Computation
Command
Code Number Description
Function
C=A+B, A, B are 32bit integers, C is 64bit integer.
32bit integers addition ADD R#A, R#B, R#C
E.g. ADD R10, R20, R30
32bit integers C=A-B, A, B are 32bit integers, C is 64bit integer.
SUB R#A, R#B, R#C
subtraction E.g. SUB R10, R20, R30
64bit MAC for long C=(A*B+C), A, B are 32bit integers, C is 64bit integer.
MAC R#A, R#B, R#C
integers E.g. MAC R10, R20, R30
Process the data in the data storage area, and the data is a 16-bit
unsigned number.
R#P: 7 register data D0-D7 starting from R#P.
D0The start address of the register where the processing result is
saved.
D1: D2 The next (future) data is at the first address (relative address,
data location) of the data buffer the historical data will be read forward
from the current position during processing).
D3: D4 The start address of the data buffer area in the data storage
area.
D5: D6 The word length of a D6 data buffer area must not be less than
the value of R#N.
R#N: The number of data processing points (1-N words per point),
0x00-0xFF, 0x00 means 256.
<MOD>=0x00
Calculate the average value, and the result is a 32-bit unsigned number
with a unit of 1/65536.
<MOD>, R#P, <MOD>=0x01
Data processing MATH
R#N Calculate the max value, and the result is a 16bit unsigned number.
<MOD>=0x02
Calculate the min value, and the result is a 16-bit unsigned number.
<MOD>=0x03
Calculate the root mean square (RMS), and the result is a 32-bit
unsigned number with a unit of 1/65536.
<MOD>=0x04
According to y=k*x+b, carry out least square method parameter
estimation.
The data storage format is (x0, y0)...(xn, yn), and the return format is (k,
b).
k, b The returned result is a 32-bit integer, and the unit is 1/65536.
<MOD>=0x05
Not support.
<MOD>=0x06
Calculate the standard deviation (RMSE), and the result is a 32-bit
unsigned number with a unit of 1/65536.
MATH 0, R0, R10
Compare the value of 2 8-bit registers (R#A and R#B). If equal, proceed
Variable conditional R#A, R#B, to the next instruction; if not equal, jump to<NUM>.
CJNE
jump (not equal) <TAB> E.g. TEST1: NOP
INC R10, 0, 1 CJNE R10,R11, TEST1
16bit Integer Compare the value for 2-bit integer in R#A and R#B. If A>=B, proceed
R#A, R#B,
conditional jump (less JS to the next instruction; If A<B, jump to <NUM>
<TAB>
than) E.g. JS R10, R12, TEST1 NOP TEST1: NOP
Compare A, B 16bit the unsigned, A>=B carry out next command, A<B
16bit comparison, R#A, R#B, jumping, range of jumping +/-127 commands.
JU
<jumping <TAB> JU R10, R12, TEST1 NOP
TEST1: NOP
Compare the value in 8-bit Register and a instant Number <INST>. If
Value conditional jump R#, <INST>, equal, process to next instruction; if not equal, jump to <NUM>.
IJNE
(number and Variable) <TAB> E.g. IJNE R10, 100, TEST1 NOP
TEST1: NOP
R#is 16bit, every count R#=R#-<NUM>, if R#> 0 jumping,
In contrast, carry out next command, range of jumping +/-
R#, <NUM>,
Decrement> 0 jumping DJNZ 127commands.
<TAB>
TEST1: NOP
DJNZ R10, 1, TEST1
Return to the main program by calling this function in the sub-program.
Return RET
E.g.RET
Interrupt program Interrupting program and return.
REIT
return RETI
Call sub-program in a position of program counter max support 32
Call sub-function CALL <PC> levels of program nesting.
E.g. CALL TEST
Program jump.
If <PC>=0xFFFF, it means taking the position of <R5:R6:R7> as the
reference, and R1: R0 as the relative PC.
Direct jump GOTO <PC>
Pointer to jump.
E.g. GOTO TEST1 NOP
TEST1: NOP
DWIN OS program over command after carrying out this command, PC
Program end END pointer reset to 0x1000, run again. same as software reset.
END
Notice:
Interrupting program should apply GOTO, RETI command.
Subprogram calling must use CALL and RET commands in pairs, transferring the program with GOTO
and RET command will result in an abnormal stack overflow.
Receiving buffer (FIFO) from COM, then reading R#B bytes (01-
<COM>, 255) to R#A register.
Read COM_Rx_FIFO RDXDAT <COM>: choose serial port, 0-2 no support, 3=UART3…
R#A, R#B
5=UART5 RDXDAT 3, R11, R10
5. Appendix
Software
Date Content Revision
version
If there is any question when you using this file or DWIN product, or willing to know more about DWIN
product news, feel free to contact us:
Hotline: 86-4000189008
Mail: [email protected]