I try to learn embedded c for a stm32-microcontorller. I try to wirte a easy blink program, where i use the sleep()-function.
code:
/* Includes ------------------------------------------------------------------*/
#include <unistd.h>
#include "main.h"
int main(void)
{
HAL_Init();
while (1)
{
HAL_GPIO_TogglePin(LD2_GPIO_Port,LD2_Pin);
sleep(1); // this line throws a error, when compiling
}
}
the compiler gives me following error:
/usr/lib/gcc/arm-none-eabi/7.4.0/../../../../arm-none-eabi/bin/ld: CMakeFiles/untitled2.elf.dir/Src/main.c.obj: in function `main':
/home/heinrich/CLionProjects/untitled2/Src/main.c:106: undefined reference to `sleep'
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/untitled2.elf.dir/build.make:391: untitled2.elf] Fehler 1
make[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/untitled2.elf.dir/all] Fehler 2
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/untitled2.elf.dir/rule] Fehler 2
make: *** [Makefile:118: untitled2.elf] Fehler 2
I think, the problem is a not-installed libary, but i installed everything in the fedora-repos for arm-gcc
OS: Fedora 30 IDE: CLion Toolchain: Arm-gcc-none-eabi