Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Having setup the Multi API-DLL and API-DLL instances for the correct target devices using functions from previous sections. Use the functions in this section to specify what code should be written by each FPA to their target device.

All data coming to and from the target device is saved in temporary buffers located inside each API-DLL instance. In summary, these buffers are the Code Data Buffer, Write Data Buffer, and Read Data Buffer shown below:

Image AddedImage Added

During normal programming using Encapsulated Functions, such as F_AutoProgram, the Code Data Buffer is used to program the target device. For custom modifications the Write Data Buffer can be used to write to the target device without disturbing the Code Data Buffer using Sequential Functions, such as F_Copy_Buffer_to_Flash.

The Read Data Buffer is used for reading from the target device by the F_Copy_Flash_to_Buffer and F_Memory_Read functions, the contents of which can be accessed using F_Get_Byte_from_Buffer.

Numberedheadings
number-formatdecimal
skip-headingsH1
start-numbering-with
h1
h2
h3
h4
h5
h6
start-numbering-atH1
12

F_ReadCodeFile

General Description

Read code from file and store in internal FPA buffer to be used in programming. Only code data that fits within the target MCUs memory space will be read, and the rest will be discarded. Therefore, it is necessary to configure the FPA for the correct MCU first, then load the code file. Unspecified locations within the code file are set to the target MCU’s default empty value (for most MCUs it is 0xFF, for some it is 0x00).

Syntax

...

cpp

Input

char * FileName : path to code file including filename and extension

Select FPA to perform operation on using F Set FPA index, index 1 to 64.Use index 0 to perform operation on all FPAs (if results differ, use F LastStatus to get individual results).

Output

INT X : result of operation

  • FALSE (0) : failed

  • TRUE (1) : succeeded

  • STATUS OPEN FILE ERROR (535): could not open file

  • STATUS FILE NAME ERROR (536): format not supported

FPA UNMATCHED RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to F LastStatus

FPA INVALID NO (-2 or 0xFFFFFFFE) : FPA not opened with F OpenInstancesAndFPAs or index out of range

F_AppendCodeFile_bookmark226_bookmark226F AppendCodeFile

General Description

Append code from selected file to internal FPA buffer to be used in programming. Only code data that fits within the target MCUs memory space will be read, and the rest will be discarded.

Already read code data is not overwritten by newly appended file. Existing code data locations that contain the default empty value (for most MCUs it is 0xFF, for some it is 0x00) can be overwritten if the OverwriteEmptyValues option is enabled in the Preferences file, prefer.ini (read from current working directory). By default, no overwrites are performed.

Syntax

INT_X F_AppendCodeFile( char * FileName )

Input

char * FileName : path to code file including filename and extension

Select FPA to perform operation on using F Set FPA index, index 1 to 64.Use index 0 to perform operation on all FPAs (if results differ, use F LastStatus to get individual results).

Output

INT X : result of operation

  • TRUE (1) : succeeded

  • STATUS OPEN FILE ERROR (535): could not open file

  • STATUS MAX FILE COUNT (557): total number of files exceeds MAX FILE INDEX (20)

  • STATUS DUPLICATE FILE PATH (558): appending already existing file

FPA UNMATCHED RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to F LastStatus

FPA INVALID NO (-2 or 0xFFFFFFFE) : FPA not opened with F OpenInstancesAndFPAs or index out of range

F_Get_CodeCS_bookmark227_bookmark227F Get CodeCS

General Description

Read code from selected buffer and calculate check sum.

Syntax

INT_X F_Get_CodeCS( INT_X dest )

Input

INT X dest : choose operation

  • 1 : Calculate checksum of code from internal Code Buffer

  • 2 : Calculate checksum of code used in last F AutoProgram or F Memory Write operation.

3 : Calculate checksum of flash memory read after last F AutoProgram or F Memory Verify operation.

Select FPA to perform operation on using F Set FPA index, index 1 to 64.Use index 0 to perform operation on all FPAs (if results differ, use F LastStatus to get individual results).

Output

INT X : result of operation

  • FALSE (0) : failed

  • any : checksum

FPA UNMATCHED RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to F LastStatus(avoid this by not using FPA index 0)

FPA INVALID NO (-2 or 0xFFFFFFFE) : FPA not opened with F OpenInstancesAndFPAs or index out of range(avoid this by using F Check FPA index first)

F_Clr_Code_Buffer_bookmark228_bookmark228F Clr Code Buffer

General Description

Clear contents of internal code buffer.

Syntax

INT_X F_Clr_Code_Buffer( void )

Input

none.

Select FPA to perform operation on using F Set FPA index, index 1 to 64.Use index 0 to perform operation on all FPAs (if results differ, use F LastStatus to get individual results).

Output

INT X : result of operation

  • FALSE (0) : failed

  • TRUE (1) : succeeded

FPA UNMATCHED RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to F LastStatus

FPA INVALID NO (-2 or 0xFFFFFFFE) : FPA not opened with F OpenInstancesAndFPAs or index out of range

F_Put_Byte_to_Code_Buffer_bookmark229_bookmark229F Put Byte to Code Buffer

General Description

Write to internal code buffer. Can be used instead of or in conjunction with the F ReadCodeFile function. When starting from scratch, use the F Clr Code Buffer function to clear the internal code buffer.

Syntax

INT_X F_Put_Byte_to_Code_Buffer( INT_X addr, BYTE data )

Input

INT X addr : valid flash address for target MCU

BYTE data : new byte to be written to internal code buffer

Select FPA to perform operation on using F Set FPA index, index 1 to 64.Use index 0 to perform operation on all FPAs (if results differ, use F LastStatus to get individual results).

Output

INT X : result of operation

  • FALSE (0) : failed

  • TRUE (1) : succeeded

FPA UNMATCHED RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to F LastStatus

FPA INVALID NO (-2 or 0xFFFFFFFE) : FPA not opened with F OpenInstancesAndFPAs or index out of range

F_Get_Byte_from_Code_Buffer_bookmark230_bookmark230F Get Byte from Code Buffer

General Description

Read from internal code buffer. Can be used in conjunction with F Put Byte to Code Buffer to verify writes to internal code buffer.

Syntax

INT_XF_Get_Byte_from_Code_Buffer( INT_X addr )

Input

INT X addr : valid flash address for target MCU

Select FPA to perform operation on using F Set FPA index, index 1 to 64.Use index 0 to perform operation on all FPAs (if results differ, use F LastStatus to get individual results).

Output

INT X : result of operation

  • BYTE (0 to 0xFF) : byte from internal code buffer

  • -1 : addr parameter out of flash range

FPA UNMATCHED RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to F LastStatus

FPA INVALID NO (-2 or 0xFFFFFFFE) : FPA not opened with F OpenInstancesAndFPAs or index out of range

F_Put_Byte_to_Buffer_bookmark231_bookmark231F Put Byte to Buffer

General Description

Write byte to temporary Write Data Buffer (see Figure 1.2).

Syntax

INT_X F_Put_Byte_to_Buffer( INT_X addr, BYTE data )

Input

INT X addr : valid flash address for target MCU

BYTE data : new byte to be written to temporary Write Data Buffer

Select FPA to perform operation on using F Set FPA index, index 1 to 64.Use index 0 to perform operation on all FPAs (if results differ, use F LastStatus to get individual results).

Output

INT X : result of operation

  • FALSE (0) : failed

  • TRUE (1) : succeeded

FPA UNMATCHED RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to F LastStatus

FPA INVALID NO (-2 or 0xFFFFFFFE) : FPA not opened with F OpenInstancesAndFPAs or index out of range

F_Get_Byte_from_Buffer_bookmark232_bookmark232F Get Byte from Buffer

General Description

Read from temporary Read Data Buffer (see Figure 1.2).

Syntax

INT_X F_Get_Byte_from_Buffer( INT_X addr )

Input

INT X addr : valid flash address for target MCU

Select FPA to perform operation on using F Set FPA index, index 1 to 64.Use index 0 to perform operation on all FPAs (if results differ, use F LastStatus to get individual results).

Output

INT X : result of operation

  • BYTE (0 to 0xFF) : byte from temporary Write Data Buffer

  • -1 : addr parameter out of flash range

FPA UNMATCHED RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to F LastStatus

FPA INVALID NO (-2 or 0xFFFFFFFE) : FPA not opened with F OpenInstancesAndFPAs or index out of range