File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,14 @@ LINK_RUNTIME=1
1515
1616DIST_DIR := ../../dist/$(ARCH ) _$(MPY_ABI_VERSION )
1717
18+
19+ ifeq ($(ARCH ) ,rv32imc)
20+ CFLAGS_MATH := -DUSE_BUILTIN_SQRTF
21+ else
22+ CFLAGS_MATH := -DUSE_IEEE_SQRTF=1
23+ endif
24+
25+
1826# Name of module
1927MOD = emlearn_plsr
2028
@@ -32,6 +40,6 @@ $(DIST_DIR):
3240$(DIST_FILE ) : $(MOD ) .mpy $(DIST_DIR )
3341 cp $< $@
3442
35- CFLAGS += -I$(EMLEARN_DIR ) -Wno-unused-function
43+ CFLAGS += -I$(EMLEARN_DIR ) -Wno-unused-function $( CFLAGS_MATH )
3644
3745dist : $(DIST_FILE )
Original file line number Diff line number Diff line change 44#include <string.h>
55
66// NOTE: make sure we do not use sqrtf() wrapper which uses errno, does not work in native module
7+ #if USE_IEEE_SQRTF
8+ #define sqrtf (x ) __ieee754_sqrtf(x)
9+ #elif USE_BUILTIN_SQRTF
710#define sqrtf (x ) __builtin_sqrtf(x)
11+ #else
12+ #endif
813
914#include "eml_plsr.h"
1015
You can’t perform that action at this time.
0 commit comments