Guides

How to extend Gapy with more options

There are 4 ways to extend Gapy with more options, depending on where it will impact Gapy:

  • Command-line options: Their role is to configure global Gapy behavior like the target or the OpenOCD cable to be used when running on a board. The number of global options should be kept low. They can be obtained with command-line option –help. Adding command-line options can only be done in the target class, by overloading the method gapylib.target.Target.append_args(). More information can be obtained here Target module.

  • Flash section properties: Their role is to configure each section behavior. They are specific to each section and thus to each flash. They can be overwritten by the flash layout defined by the target and also on the command-line using the option –flash-property. They can be obtained with command-line command flash_properties. Adding flash section properties is done by registering new properties when the section is instantiated. More information can be obtained here Flash section definition.

  • Flash attributes: Their role is to give dedicated information about the way to handle a flash. They are specific to each flash and are described by the target when the flash is registered. Their value cannot be changed from the command-line. They are used for example to give the size of each flash. Adding flash attributes is done by adding it when the flash is registered. More information can be obtained here Target module.

  • Target options: Their role is to configure specific target behavior. They can be specified using the command-line option –target-opt. These options are for now reserved for internal usage, and only used to change the architecture simulated by GVSOC.

How to change the layout of a flash

Each flash is having a default layout defined by the target. More information about the default layout can be found in the target documentation, here for Gap targets Default layout.

It is possible to define a custom layout by providing a JSON file describing the layout on the command-line using option –flash-content. More information is available here Flash layout.