Problem with custom Bootloader

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
bearcat
Respected Member
Posts: 271
Joined: Fri Mar 19, 2010 4:49 am

Problem with custom Bootloader

Postby bearcat » Thu May 26, 2011 5:59 am

Trying to build a custom loader to load factory image on input state. Used the example code on another post. Compiled ok. But when try to flash the image, got some errors:

loader.xc: Error: Type of symbol recordCandidateImage has mismatch with previous definition:
loader.xc: Error: found: signed int recordCandidateImage( signed int, unsigned int )
cc4uaaaa.s: Error: previous: void recordCandidateImage( signed int, unsigned int )
loader.xc: Error: Type of symbol recordCandidateImage has mismatch with previous definition:
loader.xc: Error: found: signed int recordCandidateImage( signed int, unsigned int )
cc4uaaaa.s: Error: previous: void recordCandidateImage( signed int, unsigned int )
Error: F03010 Failed to compile stage two loader.

Code: Select all

//xcc -c loader.xc -target=XS1-L1A-LQ64

#include <platform.h>

unsigned int keptRef=0;
unsigned int wantedVersion=0;

port buttonPort = XS1_PORT_1L;

void init()
{
  int buttState = 0;
  buttonPort :> buttState;
  wantedVersion = buttState ? 1 : 0;
  keptRef = 0;
}

int checkCandidateImageVersion( int version )
{
  return( (keptRef==0) || ( (version?1:0) == wantedVersion ) );
}

int recordCandidateImage( int version, unsigned int ref )
{
  keptRef = ref;
}

unsigned int reportSelectedImage()
{
  return( keptRef );
}


Using: xflash --loader loader.o --boot-partition-size 0x60000 --factory image.xe 0x20000

Any help? Thanks..
m_y
Experienced Member
Posts: 69
Joined: Mon May 17, 2010 10:19 am

Postby m_y » Thu May 26, 2011 6:29 am

The functions in the loader are subject to the same link-time requirements as other XC programs: unlike C, functions signatures must match at link time.

In this case the signature of your implementation of recordCandidateImage seems to be different to that expected. Try changing the return type to void:

Code: Select all

void recordCandidateImage( int version, unsigned int ref )
{
  keptRef = ref;
}
bearcat
Respected Member
Posts: 271
Joined: Fri Mar 19, 2010 4:49 am

Postby bearcat » Thu May 26, 2011 6:58 am

Thanks for the quick response!

If I had stared at the code longer I would have realized that there was no return value for that function.

Changed to what you recommended.

Works just fine now. Jumper on boots the factory code, jumper off boots upgrade code.

Who is online

Users browsing this forum: No registered users and 1 guest