SOMANET Flash Service

The SOMANET Flash Service offers an abstraction layer to access internal flash of SOMANET devices. The usage of this module is currently not recommended for end-users.

Warning

The usage of this module can erase all contents from flash and render your SoC unusable.

API

Service

void flash_service(fl_SPIPorts &SPI, interface FlashBootInterface server ?i_boot, interface FlashDataInterface server(& ?i_data)[n_data], unsigned n_data)

Service to access the data partition of the internal flash of Synapticon SoCs.

Parameters:
  • SPI – SPI port definition struct
  • i_boot – Interface for boot partition manipulation
  • i_data – Interface for data partition manipulation
  • n_data – Number of end-points in i_data array

Interface

interface FlashBootInterface

Interface to access boot partition of SOMANET SoCs.

[[guarded]] int read(char data[], unsigned nbytes, unsigned char image_num)

NOT YET IMPLEMENTED.

[[guarded]] int write(char data[], unsigned nbytes)

Writes chunk of data to boot partition of flash.

Parameters:
  • data[] – Char array holding data to be written to flash
  • nbytes – Number of bytes to be written (max 1024)
Returns:

0 - success

[[guarded]] int prepare_boot_partition()

Prepares the boot partition for a new boot image to be written.

Returns:0 - success
[[guarded]] void erase_boot_partition(void)

Deletes the boot partition of the SoC.

Note: This will remove the running program from flash, after this function is called, the device will not boot after a power cycle.

Returns:0 - success
[[guarded]] int validate_flashing(void)

Checks if the boot partition of flash contains a valid factory and upgrade image.

Returns:0 - if valid images exist
[[guarded]] int upgrade_image_installed(void)

Checks if the boot partition of flash contains a valid upgrade image.

Returns:0 - if valid image exists
[[notification]] slave void notification()
[[clears_notification]] int get_notification()
interface FlashDataInterface

Interface to store and read configurations in the data partition of SOMANET SoC Flash.

[[guarded]] int get_configurations(int type, unsigned char buffer[], unsigned &n_bytes)

Reads configurations from the data partition of flash.

Parameters:
  • type – Type of configuration data to read
  • buffer – Array of chars to which the read configuration shall be written
  • n_bytes – Amount of bytes read from flash
Returns:

0 - if reading of configuration was successful

[[guarded]] int set_configurations(int type, unsigned char data[n_bytes], unsigned n_bytes)

Writes configuration to the data partition of flash.

Parameters:
  • type – Type of configuration data to read
  • data – Array of chars containing the configuration data to be written
  • n_bytes – Amount of bytes to write
Returns:

0 - if writing of data was successful

Types

configuration_type

Enum defining different configuration types.

Currently only motor configurations are supported

Enum Values:

MOTCTRL_CONFIG