Showing results for 
Search instead for 
Did you mean: 

linking error when using retargetF (_kill_r)

Harvey White
Senior III

Ran into a problem once I upgraded to 1.13.0.

Programs were failing with two errors, one relating to _kill_r.  There was a warning that _kill_r will always fail, and then a fatal error.

I'm using retargetF.c and retargetF.h to redirect the standard console to a uart driver to enable debug logging.

To use this, syscalls.c must be excluded from the build due to multiple function definitions.

With syscalls.c the errors go away, but the redirect function is, of course, unavailable.

Examining the files shows that syscalls.c includes two functions (and previous compilers/builds did not flag this) which are missing in the retargetF.C

the code for retargetF needs the following lines added:


int _getpid(void)
  return 1;

int _kill(int pid, int sig)
  errno = EINVAL;
  return -1;


and for retargetF.h add:


int _getpid(void);

int _kill(int pid, int sig);

The code now compiles.