This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to migrate retarget.c from ARM Compiler 5 to ARM Compiler 6?

I want to migrate an older project into the ARM Compiler 6, but I am getting errors in the retarget.c

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* Short version of retarget.c - Minimum code to support simple printf in Keil
MDK-ARM */
/**************************************************************/
/* Minimum retarget functions for
ARM DS-5 Professional / Keil MDK */
/**************************************************************/
#pragma import(__use_no_semihosting_swi)
#include <lpc17xx.h>
#include <stdio.h>
struct __FILE { int handle; /* Add whatever you need here */ };
FILE __stdout;
FILE __stdin;
FILE __stderr;
int fputc(int ch, FILE *f) {
return (ITM_SendChar(ch));
}
void _sys_exit(int return_code) {
label: goto label; /* endless loop */
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
retarget.c(7): error: '#pragma import' is an ARM Compiler 5 extension, and is not supported by ARM Compiler 6 [-Warmcc-pragma-import]
#pragma import(__use_no_semihosting_swi)
^
retarget.c(10): error: redefinition of '__FILE'
struct __FILE { int handle; /* Add whatever you need here */ };
^
C:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stdio.h(119): note: previous definition is here
struct __FILE {
^
2 errors generated.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

When I read in the documentation I find a retarget_io.c. Can I just take that one instead and delete the old retarget.c?

0