2 #define NULL ((void*)0)
9 typedef unsigned char UINT8
;
10 typedef unsigned short UINT16
;
11 typedef unsigned long UINT32
;
14 typedef void(*tpFunc
)(void); // type for execute
15 typedef int(*tpMain
)(void); // type for start vector to main()
18 // structure of an image in the flash
21 UINT32
* pDestination
; // address to copy it to
22 UINT32 size
; // how many bytes of payload (to the next header)
23 tpFunc pExecute
; // entry point
24 UINT32 flags
; // uncompressed or compressed
25 // end of header, now comes the payload
26 UINT32 image
[]; // the binary image starts here
27 // after the payload, the next header may follow, all 0xFF if none
30 // flags valid for image header
31 #define IF_NONE 0x00000000
32 #define IF_UCL_2E 0x00000001 // image is compressed with UCL, algorithm 2e
35 // resolve platform dependency of F1 button check
36 #if defined PLATFORM_PLAYER
37 #define F1_MASK 0x0001 // Player has no F1 button, so we use "-"
38 #define F2_MASK 0x0008 // Player has no F2 button, so we use "Play"
39 #define F3_MASK 0x0004 // Player has no F3 button, so we use "+"
41 #elif defined PLATFORM_RECORDER
51 #elif defined PLATFORM_FM
61 #elif defined PLATFORM_ONDIO
64 #define F1_LOWER 0x2EF // Ondio has no F1 button,
65 #define F1_UPPER 0x3FF // so we use "Left".
66 #define F2_LOWER 0x19D // Ondio has no F2 button,
67 #define F2_UPPER 0x245 // so we use "Up".
68 #define F3_LOWER 0x246 // Ondio has no F3 button,
69 #define F3_UPPER 0x2EE // so we use "Right".
72 #error ("No platform given!")
76 #define FLASH_BASE 0x02000000 // start of the flash memory
77 #define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
80 int ucl_nrv2e_decompress_8(const UINT8
*src
, UINT8
*dst
, UINT32
* dst_len
);
81 void _main(void) __attribute__ ((section (".startup")));
85 #define BAUDRATE 0x00 // followed by BRR value; response: command byte
86 #define ADDRESS 0x01 // followed by 4 bytes address; response: command byte
87 #define BYTE_READ 0x02 // response: 1 byte content
88 #define BYTE_WRITE 0x03 // followed by 1 byte content; response: command byte
89 #define BYTE_READ16 0x04 // response: 16 bytes content
90 #define BYTE_WRITE16 0x05 // followed by 16 bytes; response: command byte
91 #define BYTE_FLASH 0x06 // followed by 1 byte content; response: command byte
92 #define BYTE_FLASH16 0x07 // followed by 16 bytes; response: command byte
93 #define HALFWORD_READ 0x08 // response: 2 byte content
94 #define HALFWORD_WRITE 0x09 // followed by 2 byte content; response: command byte
95 #define EXECUTE 0x0A // response: command byte if call returns
96 #define VERSION 0x0B // response: version
100 extern UINT32 begin_text
[];
101 extern UINT32 end_text
[];
102 extern UINT32 begin_data
[];
103 extern UINT32 end_data
[];
104 extern UINT32 begin_bss
[];
105 extern UINT32 end_bss
[];
106 extern UINT32 begin_stack
[];
107 extern UINT32 end_stack
[];
108 extern UINT32 begin_iramcopy
[];
109 extern UINT32 total_size
[];