Skip to content

Commit c4d4013

Browse files
committed
examples/natmod/deepcraft: SOme more trials.
Signed-off-by: NikhitaR-IFX <nikhita.rajasekhar@infineon.com>
1 parent 69dbeae commit c4d4013

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

examples/natmod/deepcraft/Makefile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@ ARCH = armv7emsp
1414
LINK_RUNTIME = 1
1515

1616
CFLAGS += -Dsqrtf=__builtin_sqrtf -fno-math-errno -fno-trapping-math -fno-builtin-logf -ffreestanding
17-
CFLAGS += --data-sections
18-
# If -lm is required:
19-
# Even stronger — exclude specific problematic objects
20-
LDFLAGS += -Wl,--exclude-libs,ALL
21-
22-
23-
24-
17+
CFLAGS += -Dlogf=logf
2518

2619
#CFLAGS += -Dlogf=__builtin_logf -ffreestanding -fno-math-errno -fno-trapping-math -ffast-math
2720

examples/natmod/deepcraft/dc_mp_iface.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ void *memcpy(void *dst, const void *src, size_t n) {
88
void *memset(void *s, int c, size_t n) {
99
return mp_fun_table.memset_(s, c, n);
1010
}
11+
12+
__attribute__((weak))
13+
float logf(float x) {
14+
// Basic fallback or dummy version — avoids pulling in full libm
15+
// Replace with your approximation if needed
16+
return 0.0f; // Just to satisfy the linker
17+
}
18+
1119
/*float logf(float x) {
1220
// Optional: You can define a very basic approximation, or just return x
1321
// to make the code compile and defer real computation

examples/natmod/deepcraft/model.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8029,7 +8029,7 @@ static inline void softmax_f32(const float* restrict x, int count, float* restri
80298029
{
80308030
float sum = 0;
80318031
for (int i = 0; i < count; i++) {
8032-
float value = expf(x[i]);
8032+
float value = 0;expf(x[i]);
80338033
sum += value;
80348034
result[i] = value;
80358035
}
@@ -8070,10 +8070,10 @@ int IMAI_dequeue(float *restrict data_out) {
80708070
norm_f32(_K6, 1, 2, 257, _K10);
80718071
mel_f32(_K10, _K11, 257, 1, 20, _K12);
80728072
clip_f32(_K12, 20, 0.000316227766016, 3.40282347E+38, _K13);
8073-
loge_f32(_K13, 20, _K14);
8073+
//loge_f32(_K13, 20, _K14);
80748074
__RETURN_ERROR_BREAK_EMPTY(fixwin_enqueuef32(_K16, _K14));
80758075
}
8076-
/*__RETURN_ERROR(fixwin_dequeuef32(_K16, _K15, 33));
8076+
__RETURN_ERROR(fixwin_dequeuef32(_K16, _K15, 33));
80778077
conv2d_f32(_K15, _K18, _K17, 12, 5, 5, 2, 2, 60, 20, 1, 1, 2, 1, 2);
80788078
mul_f32(_K17, _K20, 1, 1, 1, 300, 12, _K22);
80798079
add_f32(_K22, _K21, 1, 1, 1, 300, 12, _K19);
@@ -8091,7 +8091,7 @@ int IMAI_dequeue(float *restrict data_out) {
80918091
globav2d_f32(_K41, 3, 8, 32, _K42);
80928092
dott_f32(_K43, _K42, _K44, 32, 2, 1);
80938093
add_f32(_K44, _K45, 1, 1, 1, 1, 2, _K46);
8094-
softmax_f32(_K46, 2, data_out);*/
8094+
softmax_f32(_K46, 2, data_out);
80958095
return 0;
80968096
}
80978097

0 commit comments

Comments
 (0)