Main Content

Specify the Hardware

Specify the name of your hardware. This name displays in Simulink® dialog boxes so that the users can select it when they want to build a model for it. Also, specify the processor ID that determines the sizes of the different data types used by the processors that your hardware includes. Repeat these steps for each hardware device that your target supports.

  1. Create the Hardware object, hw, that represents your hardware by calling createHardware with the name you chose for the hardware, for example, 'My ARM Cortex A Board'.

    hw = createHardware('My ARM Cortex A Board');

    You map the Hardware object, hw, to the Target object, tgt, in a later step.

  2. Set the DeviceID property of the Hardware object to a name-identifier of the processor that your hardware includes, for example, 'ARM Cortex-A9'.

    hw.DeviceID = 'ARM Compatible->ARM Cortex-A (32-bit)';
  3. View the properties of the Hardware object.

    hw
    hw = 
    
      Hardware with properties:
    
               Name: 'My ARM Cortex A Board'
           DeviceID: 'ARM Compatible->ARM Cortex-A (32-bit)'
        IOInterface: {}
  4. Map the Hardware object to the Target object by calling map with the name you chose for your hardware for Simulink dialog boxes, for example, 'My ARM Cortex A Board'.

    map(tgt,hw,'My ARM Cortex A Board');

    The name used in this command is also known as the display name. The display name enables you to have unique names appear in the dialog boxes for the hardware even when the same Hardware object is mapped to different Target objects.

    For example, suppose that you want your new target to support the same hardware that its reference target already supports. Since the names of the hardware supported by both targets show in the same list in Simulink, the display name used for the hardware with your new target must be different than the display name used for the same hardware with the reference target.

    The Hardware object, is now mapped to your Target object. The display name of the hardware is set to 'My ARM Cortex A Board'.

    Do not delete the Hardware object, hw, from the MATLAB® workspace before you save the target.

  5. Confirm that your target supports the hardware and that the hardware display name is 'My ARM Cortex A Board'.

    show(tgt);
                       My ARM Cortex A Board
    Display Name       My ARM Cortex A Board
    

    The output shows that the hardware 'My ARM Cortex A Board' is added to the target with the display name 'My ARM Cortex A Board'.

  6. Define I/O interfaces for each hardware device that your target supports. The hardware can have multiple I/O interfaces of either Ethernet or serial type. Typically, ARM® Cortex®-A hardware uses an Ethernet interface. I/O interfaces are used for the PIL and External mode features, which you will add to your target in later steps.

  7. Add an Ethernet interface to the hardware by calling addNewEthernetInterface with the name of the interface to be displayed in Simulink, for example, 'My Ethernet Interface'.

    io = addNewEthernetInterface(hw,'My Ethernet Interface');

    A similar command exists for the serial interface. For more information, see addNewSerialInterface.

  8. View the properties of the EthernetInterface object, io.

    io
    io = 
    
      EthernetInterface with properties:
    
        IPAddress: '127.0.0.1'
             Port: 17725
         Password: 'root'
         Username: 'root'
             Name: 'My Ethernet Interface'

    Set the properties as appropriate for your hardware.

  9. Save the target description information to that target’s framework.

    saveTarget(tgt);
  10. Test that the hardware has been registered successfully.

    testTarget(tgt,'hardware');

    Upon completion of the test, a summary result is displayed. If the test PASSED, then you can proceed with adding the next feature. Otherwise, if the test either FAILED or is INCOMPLETE, a link to the test diagnostic logs is shown below the test summary.

Repeat the process in this section for each additional hardware device your new target supports. Use unique hardware names each time.

Example

Confirm that your hardware is registered with Simulink by following the steps below.

  1. Create a new Simulink model and select Simulation > Model Configuration Parameters.

  2. In the Configuration Parameters dialog box, select Solver.

  3. From the Type list, select Fixed-step. From the Solver list, select auto.

  4. In the Configuration Parameters dialog box, select Hardware Implementation.

  5. Expand the Hardware board list and confirm the selection of name that you specified for your hardware.

    The Hardware Board selection in the Hardware Implementation pane of the Configuration Parameters dialog box displays your specified hardware name.

  6. Click Cancel.