Code: |
AS + 100 |
Symbolic: |
bccFlashFileLoad |
This command will load a generic file from the local disk to a flash folder of the connected device. Request parameters are the following:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U32 |
FLAGS |
Operating flags: 0x00000001 Overwrite target file 0x00000002 Recover load, if needed 0x00000004 No BIF16 handling 0x00000008 Special load as BOOT (#1) 0x00000010 Special load as BIOS (#1) 0x00000020 Special load as MAIN (#1) 0x00000040 Special load as CFG (#1) 0x00000080 (reserved) 0x00000100 (reserved) |
4 |
U32 |
FILESIZE |
Effective file length [bytes] |
8 |
U32 |
ALLOADDR |
Allocation address (only BIF16) |
12 |
U32 |
STARTADDR |
Start address (only BIF16) |
16 |
U8 |
HH |
Time (hour) of the file |
17 |
U8 |
MM |
Time (minute) of the file |
18 |
U8 |
SS |
Time (second) of the file |
19 |
U8 |
DD |
Date (day) of the file |
20 |
U8 |
MO |
Date (month) of the file |
21 |
U8 |
YY |
Date (year - 2000) of the file |
22 |
U32 |
ATTR |
Attributes: 0x00000002 Reserved file 0x00000004 System file 0x00000020 Hidden file 0x00000040 Read-only file 0xF0000000 File type mask: - 0x0 Generic - 0x2 OS standard - 0x3 OS test - 0x4 OS standard flat - 0x5 Old language (without OS) - 0x6 FIFO (queue) |
26 |
STRZ |
FILENAME |
Filename |
(#1) Special load flags are all exclusive.
Notes:
•to load a file in a specific folder, without specifying a new filename, you need to specify the final / character: /FOLDER is the folder itself and will be not accepted (illegal arguments) while the correct target filename is /FOLDER/.
On failure, a bccNack is received. Specific errors
NACK code |
Description |
Extra data |
---|---|---|
nackOpenError |
Error opening flash file |
|
nackMemoryFull |
Out of memory (or flash full) |
|
nackWriteError |
Error writing flash file |
|
nackDataOverflow |
Received more data than required |
|
nackDataUnderflow |
Received less data than required |
|
nackIllegalArgs
|
Illegal parameters |
U16 What illegal: 1=Folder 2=Filename 3=File size 4=Flags 5=Alloc address 6=Start address 7=Date/time 8=Attribute |
nackFileExist |
The flash file exist and overwrite flags has not been specified |
|
nackIllegalFile |
The file is illegal or not recognized for special type loading |
|
nackReadOnly |
The existing file (or the flash itself) file is read-only and cannot be created/overwritten. |
|
On success, a bccAck is received with following data:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U32 |
OFFSET |
Starting load offset |
4 |
U16 |
CRC16 |
CRC16 of file portion from 0 to (OFFSET-1) |
6 |
U8 |
BSIZE |
Required data size (0=default), excluding leading U32 offset data. |
NOTE: the SCH value of this bccAck will be the DCH for all subsequent commands/message for this data transfer.
At this time the device will wait a for a bccCheck command to confirm operation and effective start offset. If OFFSET is greater than zero, the file CRC16 should be verified for the partial file from offset 0 to (OFFSET-1): if match, we are loading the same file and load can be recovered: otherwise, we well restart from offset 0.
The bccCheck command data is the following:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U32 |
FLAGS |
Operating flags: 0x00000001 Remove temporary files |
4 |
U32 |
OFFSET |
Effective offset to be used |
On failure, a bccNack is received and the operation is aborted:
On success, a bccAck is received and the transfer process can begin.
The device will send you periodically a bccIBlock message, indicating how many data packet you can send to the device itself: after you transmit the required packet (or less i transmitting a bccEndData), you will receive a new bccIBlock.
The bccIBlock has the following data:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U8 |
COUNT |
N. of binary packet to send |
Notes:
•If you don't receive the bccIBlock after an amount of time, you can decide to abort the transfer, using the bccAbort command.
•On slower communication lines use 1 as COUNT value; on standard RS232 use 3 as COUNT value.
File raw content (data) will be send with the bccData message (for last packet use bccEndData to indicate end of data), with the following format:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U32 |
OFFSET |
Data offset |
4 |
B[251] |
DATA |
Binary data to send |
Notes:
•bccData (or bccEndData) messages will begin with pid = 0 and will be incremented by 1 at each message.
•DATA size is 251 (or BSIZE if specified on first request bccAck) for each bccData message but could be less for bccEndData message.
•The data transfer could be aborted at any time with a bccAbort command.
•If required file is empty, send directly bccNoData message and wait for end of transfer.
After you send the bccEndData (or bccNoData) message you should wait the bccCompleted message that report what the device has received, with the following format:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U32 |
SIZE |
Total file size [bytes] |
4 |
U32 |
COUNT |
No. of total binary packet received |
Notes:
•If this message is not received in an amount of time, you can consider the transfer aborted (not confirmed). If the remote device need more time in order to complete the operation, it can periodically send the bccWait message, until the operation completes.
•Some BCC/31 implementation have limit on the total delay time for bccWait messages: when the limit is reached, the operation will expire.
•The bccCompleted indicate that also all pending operations (for examples reload in memory or restarting) has been successfully completed.
At any time the device can decide to abort the transfer (not when you already are in abort condition). In this case you will receive the notification via the bccAborted message.