I am new to Atmel Studio. I created new GCC C Execute project with ATSAMV71Q21 device. In main.c file added printf then run build and got bunch of "undefined reference to (_write, _fsta, etc) error. I tried Atmel "getting-started" example and it worked fine. How can I fix this problem? Below are the code and error message. Thanks for help.
#include "sam.h"
#include <stdio.h>
#include <stdbool.h>
int main(void)
{
/* Initialize the SAM system */
SystemInit();
while (1)
{
printf("abc");
//TODO:: Please write your application code
}
}
d:/atmel/atmel toolchain/arm gcc/native/4.8.1443/arm-gnu-toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-sbrkr.o): In function '_sbrk_r': D:\Atmel\samv71_softpack_1.4_for_astudio_6_2\studio\Atmel\samv71_Xplained_Ultra\examples\test\test\Debug\sbrkr.c(1,1): error: undefined reference to '_sbrk'
I don't yet know how to do what you want with a bare-bones C-program (
#include "sam.h"
), but I can help you if you are willing to use the ASF API.You have to generate a C-ASF-project first. Then you add Standard Serial I/O to your project using the ASF wizard. Configure properly, and printf, puts, ... will print to a terminal program that is connected to the controller.
This works on an Arduino Due which has a SAM3X8E controller.