Skip to content

Commit 03557f3

Browse files
committed
Fix to build with ISO C standard
This allow to build with c11 instead of gnu11 (GNU dialect of ISO C11) Avoid strdup usage and use correct asm keyword. Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent 2c12278 commit 03557f3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

cores/arduino/avr/dtostrf.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ char *dtostrf(double val, signed char width, unsigned char prec, char *sout)
8080
memset(fmt, ' ', 128);
8181
fmt[w - strlen(sout)] = '\0';
8282
if (negative == 0) {
83-
char *tmp = strdup(sout);
83+
char *tmp = malloc(strlen(sout) + 1);
84+
strcpy(tmp, sout);
8485
strcpy(sout, fmt);
8586
strcat(sout, tmp);
8687
free(tmp);

cores/arduino/stm32/dwt.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ uint32_t dwt_init(void)
4343
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
4444

4545
/* 3 NO OPERATION instructions */
46-
asm volatile(" nop \n\t"
47-
" nop \n\t"
48-
" nop \n\t");
46+
__asm volatile(" nop \n\t"
47+
" nop \n\t"
48+
" nop \n\t");
4949

5050
/* Check if clock cycle counter has started */
5151
return (DWT->CYCCNT) ? 0 : 1;

0 commit comments

Comments
 (0)