Added support and example for libm

rocketry
Richard Eoin Meadows 2014-07-09 21:51:46 +01:00
rodzic 80c7440f81
commit 9955b7d050
3 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -95,7 +95,7 @@ endif
CFLAGS += $(COMPILATION_FLAGS) -Wall -Wextra $(ACCEPT_WARN) -std=gnu99 \
-ffunction-sections -fdata-sections $(ARCH_FLAGS)
ASFLAGS += -Wall $(ARCH_FLAGS) -a=/dev/null
LDFLAGS += $(COMPILATION_FLAGS) -lm $(LINKER_FLAGS) -lm -Wextra $(ARCH_FLAGS)
LDFLAGS += $(COMPILATION_FLAGS) $(LINKER_FLAGS) -Wextra $(ARCH_FLAGS)
# Compilation Defines
#

Wyświetl plik

@ -54,6 +54,8 @@
*/
ENTRY(Reset_Handler)
GROUP(libgcc.a libc.a libm.a)
SECTIONS
{
.text :

Wyświetl plik

@ -26,6 +26,7 @@
#include "pindefs.h"
#include <stdio.h>
#include <math.h>
#include "semihosting.h"
int main(void)
@ -41,7 +42,12 @@ int main(void)
/* Configure the SysTick for 50ms interrupts */
SysTick_Config(SystemCoreClock / 20);
semihost_printf("Hello World\n");
volatile double d, dd;
d = 2;
dd = sqrt(d);
semihost_printf("Hello World %f\n", dd);
while (1);
}