please refer attached example code on Linux user space for populating an array with ARM and pass it to as a parameter to API for loading ARM. If you still see the same error, please let us know.
One importatnt thing to note is that API release and GUI release have tight coupling with ARM firmware. Make sure you pick up ARM file from same version of release available at
http://www.analog.com/en/design-center/landing-pages/001/transceiver-evaluation-software.html
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "arm_binary.h"
#include "utilities.h"
#include "mykonos_dbgjesd.h"
#include "mykonos_macros.h"
#include "fru.h"
#include "fmc_eeprom.h"
#include "mykonos_fpga_ip.h"
#include "ad9528.h"
#include "myk_clock_init.h"
#include "utilities.h"
#include "mykonos_dbgjesd.h"
#include "mykonos_macros.h"
#include "fru.h"
#include "fmc_eeprom.h"
#include "mykonos_fpga_ip.h"
#include "ad9528.h"
#include "myk_clock_init.h"
/* Read ARM firmware file and populate an array to be consumed by API
*********************************************************************************
* \brief Load the ARM firmware file into a char array to be consumed by API
*
* \pre This function will throw an error if user provide invalid file. Firmware endianess will be maintained.
* User should shift specific offset data to match the host endianess.
*
* \post Binary array will be populated.
*
* <B>Dependencies</B>
* Valid firmware file path.
* \param[in] filePath ARM firmware file path on local system
* \retval MYKONOS_UTIL_OK Function completed successfully
* \retval MYKONOS_UTIL_ERR_FILE_OPEN Error opening the firmware file
* \retval MYKONOS_UTIL_ERR_INVALID_FW_LENGHT File exceeded buffer size
*/
mykonosUtilErr_t ReadARMFirmware(char* fileNamePath)
{
/* Check for a valid firmware file */
if (!fileNamePath)
{
return MYKONOS_UTIL_ERR_INVALID_FILE;
}
#if (MYKONOS_VERBOSE == 1)
CMB_writeToLog(ADIHAL_LOG_MESSAGE, 0, 0, "ReadARMFirmware()\n");
#endif
*********************************************************************************
* \brief Load the ARM firmware file into a char array to be consumed by API
*
* \pre This function will throw an error if user provide invalid file. Firmware endianess will be maintained.
* User should shift specific offset data to match the host endianess.
*
* \post Binary array will be populated.
*
* <B>Dependencies</B>
* Valid firmware file path.
* \param[in] filePath ARM firmware file path on local system
* \retval MYKONOS_UTIL_OK Function completed successfully
* \retval MYKONOS_UTIL_ERR_FILE_OPEN Error opening the firmware file
* \retval MYKONOS_UTIL_ERR_INVALID_FW_LENGHT File exceeded buffer size
*/
mykonosUtilErr_t ReadARMFirmware(char* fileNamePath)
{
/* Check for a valid firmware file */
if (!fileNamePath)
{
return MYKONOS_UTIL_ERR_INVALID_FILE;
}
#if (MYKONOS_VERBOSE == 1)
CMB_writeToLog(ADIHAL_LOG_MESSAGE, 0, 0, "ReadARMFirmware()\n");
#endif
FILE *file = NULL;
long flen = 0;
if((file = fopen(fileNamePath, "rb")) == NULL)
{
/* can't open file */
return MYKONOS_UTIL_ERR_FILE_OPEN;
}
/* Get file length */
if(fseek(file, 0, SEEK_END)!=0)
{
return MYKONOS_UTIL_ERR_FILE_OPERATION;
}
flen = ftell(file);
if(flen!=-1L)
{
rewind(file);
}
else
{
return MYKONOS_UTIL_ERR_FILE_OPERATION;
}
long flen = 0;
if((file = fopen(fileNamePath, "rb")) == NULL)
{
/* can't open file */
return MYKONOS_UTIL_ERR_FILE_OPEN;
}
/* Get file length */
if(fseek(file, 0, SEEK_END)!=0)
{
return MYKONOS_UTIL_ERR_FILE_OPERATION;
}
flen = ftell(file);
if(flen!=-1L)
{
rewind(file);
}
else
{
return MYKONOS_UTIL_ERR_FILE_OPERATION;
}
/* File bigger than max length */
if(flen > MAX_ARM_FW_FILE_LENGTH)
{
/* invalid firmware file */
return MYKONOS_UTIL_ERR_INVALID_FW_LENGHT;
}
/* populate ARM binary */
if(fread(binary, 1,flen, file)==0)
{
return MYKONOS_UTIL_ERR_FILE_OPERATION;
}
if(fclose(file)!=0)
{
return MYKONOS_UTIL_ERR_FILE_OPERATION;
}
if(fread(binary, 1,flen, file)==0)
{
return MYKONOS_UTIL_ERR_FILE_OPERATION;
}
if(fclose(file)!=0)
{
return MYKONOS_UTIL_ERR_FILE_OPERATION;
}
/* Success */
return MYKONOS_UTIL_OK;
}
return MYKONOS_UTIL_OK;
}
and this will be called in 'headless.c' as below
/*************************************************************************/
/***** Mykonos Load ARM file *****/
/*************************************************************************/
puts("Loading ARM binary");
char armbin[] = "/home/analog/Mykonos_M3.bin";
ReadARMFirmware(armbin);
if (pllLockStatus & 0x01)
{
if ((mykError = MYKONOS_initArm(&mykDevice)) != MYKONOS_ERR_OK)
{
/*** < Info: errorString will contain log error string in order to debug why failed > ***/
////errorString = getMykonosErrorMessage(mykError);
puts("ARM did init properly");
fflush(stdout);
puts(getMykonosErrorMessage(mykError));
/***** Mykonos Load ARM file *****/
/*************************************************************************/
puts("Loading ARM binary");
char armbin[] = "/home/analog/Mykonos_M3.bin";
ReadARMFirmware(armbin);
if (pllLockStatus & 0x01)
{
if ((mykError = MYKONOS_initArm(&mykDevice)) != MYKONOS_ERR_OK)
{
/*** < Info: errorString will contain log error string in order to debug why failed > ***/
////errorString = getMykonosErrorMessage(mykError);
puts("ARM did init properly");
fflush(stdout);
puts(getMykonosErrorMessage(mykError));
}
/*** < Action: User must load ARM binary byte array into variable binary[98304] before calling next command > ***/
if ((mykError = MYKONOS_loadArmFromBinary(&mykDevice, &binary[0], ARM_BINARY_SIZE)) != MYKONOS_ERR_OK)
{
/*** < Info: errorString will contain log error string in order to debug why
* ARM did not load properly - check binary and device settings > ***/
/*** < Action: User code > ***/
//errorString = getMykonosErrorMessage(mykError);
puts("ARM did not load properly");
fflush(stdout);
puts(getMykonosErrorMessage(mykError));
if ((mykError = MYKONOS_loadArmFromBinary(&mykDevice, &binary[0], ARM_BINARY_SIZE)) != MYKONOS_ERR_OK)
{
/*** < Info: errorString will contain log error string in order to debug why
* ARM did not load properly - check binary and device settings > ***/
/*** < Action: User code > ***/
//errorString = getMykonosErrorMessage(mykError);
puts("ARM did not load properly");
fflush(stdout);
puts(getMykonosErrorMessage(mykError));
}
}
else
{
/*** < Action: check settings for proper CLKPLL lock > ***/
}
else
{
/*** < Action: check settings for proper CLKPLL lock > ***/
}