Skip to end of banner
Go to start of banner

How to build an application firmware(NAI) with Hilscher file header?

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Q

As is known, MFW (Maintenance Firmware) V1.2 and higher versions cannot update a customer NAI firmware if Hilscher file header is missing in the NAI file.

How to add the Hilscher file header to a netX90 application project so that the MFW can update it?

A

Hilscher file header V3 header file, fileheader definition, linker file and wscript file should be changed accordingly to build a NAI file with file header.


  • add Hil_FileHeaderV3.h in your project

Add the Definitions component (Definitions.zip) containing HilscherDefinitions and wscript file to the project components.

Note: If you have HilscherDefinitions already, you don't need to add them again. However, please check whether the header file Hil_FileHeaderV3.h is the latest.


  • add HIL_FILE_NAI_HEADER_V3_0_T  information in Targets/NXHX90-JTAG/Source/netx90_app_header.c

#include "Hil_FileHeaderV3.h"


HIL_FILE_NAI_HEADER_V3_0_T app_cpu_header_nai __attribute__ ((section (".app_cpu_header_nai"))) =
{
  .tBootHeader =
  {
    .ulMagicCookie = HIL_FILE_HEADER_FIRMWARE_NAI_COOKIE,
    .ulAppChecksum = 0,
    .ulAppFileSize = 0,
    .ulSignature = HIL_FILE_BOOT_HEADER_SIGNATURE,
    .ulBootHeaderChecksum = 0,
  },
  .tCommonHeader =
  {
    .ulHeaderVersion = HIL_VERSION_COMMON_HEADER_3_0,
    .ulHeaderLength = sizeof(app_cpu_header_nai),
    .ulDataSize = 0,
    .ulDataStartOffset = 0,
    .bNumModuleInfos = 0,
    .aulMD5 = {0},
    .ulTagListSize = 0,
    .ulTagListOffset = 0,
    .ulTagListSizeMax = 0,
    .ulCommonCRC32 = 0,
    .ulHeaderCRC32 = 0,
  },
  .tDeviceInfo =
  {
    .ulStructVersion = HIL_VERSION_DEVICE_INFO_V1_0,
    .usManufacturer = HIL_MANUFACTURER_HILSCHER_GMBH,
    //.usDeviceClass = HIL_HW_DEV_CLASS_UNDEFINED,
    .usDeviceClass = HIL_HW_DEV_CLASS_CHIP_NETX_90_APP_FOR_COM_USECASE_A,
    //.usDeviceClass = HIL_HW_DEV_CLASS_CHIP_NETX_90_APP_FOR_COM_USECASE_C,
    .bHwCompatibility = 0,
    .bChipType = HIL_DEV_CHIP_TYPE_NETX90,
    .ausHwOptions = {HIL_HW_ASSEMBLY_ETHERNET, HIL_HW_ASSEMBLY_ETHERNET, HIL_HW_ASSEMBLY_NOT_AVAILABLE, HIL_HW_ASSEMBLY_NOT_AVAILABLE},
    .ulLicenseFlags1 = 0,
    .ulLicenseFlags2 = 0,
    .usNetXLicenseID = 0,
    .usNetXLicenseFlags = 0,
    .ausFwVersion = {0},
    .ulDeviceNumber = 0,
    .ulFwNumber = 0,
    .ulSerialNumber = 0,
  },
};


  • add section (".app_cpu_header_nai") in the linker file Targets/NXHX90-JTAG/Linker/netx90_app_iflash.ld

SECTIONS
{
    .text.nai_header  ORIGIN(FLASH) :
    {
        KEEP(*(.vectors))
        __Vectors_End = .;
        __Vectors_Size = __Vectors_End - __Vectors;
        __end__ = .;
                
        KEEP(*(.app_cpu_hboot_boot_header_nai))
        KEEP(*(.app_cpu_header_nai))
    } > FLASH


  • add "Hil_Definition_netXFirmware_sdk" in the used sdk components in target wscript

  • use bld.firmware in the target wscript instead of bld.generate_netx90_intflash2_image

    uses = [

        "CMSIS",

        "netx_drv",

        "Hil_Definition_netXFirmware_sdk"

        ]


  bld.firmware(

        target           = "nx90_app.nai",

        name             = toolchain_prefix + "netx90_app_iflash",

        toolchain        = toolchain,

        platform         = "netx90",

        source           = sources,

        includes         = includes,

        defines          = defines,

        use              = uses,

        stlib            = 'm c',

        linkerscript     = ["Linker/netx90_app_iflash.ld"],

        features         = ["group_lib"],

        netx_type        = 'netx90_rev1',

    )

instead of

    bld.program(

        target           = "netx90_app_iflash",

        name             = toolchain_prefix + "netx90_app_iflash",

        toolchain        = toolchain,

        platform         = "netx90",

        source           = sources,

        includes         = includes,

        defines          = defines,

        use              = uses,

        linkerscript     = ["Linker/netx90_app_iflash.ld"],

    )

    

    bld.generate_netx90_intflash2_image(

        target           = "netx90_app_iflash.nai",

        use              = toolchain_prefix + "netx90_app_iflash"



  • add Hilscher waf tool if it is not available in your project. (Just copy the complete WAF folder as the example)


Attached are two netX90 application projects of use case A. (DIO_ChaseLights.zip, DIO_ChaseLights_FileHeader.zip)

"DIO_ChaseLights.zip" is a simple DIO example without fileheader.  Try to update the "netx90_app_iflash.nai" (you must change the name to 8.3 format first) with MFW V2.0.0.0, it fails. The SYS led turns yellow, and you will get a System Error 0xC0001152 (ERR_HIL_NOT_AVAILABLE)

You can find the definition in Hil_Results.h

/* MessageText: Update file or destination (XIP-Area) not found. */


"DIO_ChaseLights_FileHeader" is the updated project, which contains Hilscher file header information. You can successfully update "nx90_app.nai" with MFW V2.0.0.0. The SYS led blinks yellow and green first,  and then stays green, which means that the update firmware is running successfully.


  • No labels