Skip to content

Commit 93c6355

Browse files
committed
Resolving syscalls/_sbrk issue
1 parent b2db3a7 commit 93c6355

File tree

6 files changed

+29
-229
lines changed

6 files changed

+29
-229
lines changed

Diff for: cores/arduino/syscalls.c

-140
This file was deleted.

Diff for: cores/arduino/syscalls.h

-68
This file was deleted.

Diff for: cores/validation/validation_core/test.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ int valY = 0;
3737

3838
void setup( void )
3939
{
40+
char *pcBuff ;
41+
4042
// Initialize the digital pin as an output.
4143
// Pin PIN_LED has an LED connected on most Arduino boards:
4244
//pinMode( PIN_LED, OUTPUT ) ;
@@ -69,6 +71,13 @@ void setup( void )
6971
attachInterrupt( 5, Interrupt_Pin5, FALLING ) ;
7072
attachInterrupt( 6, Interrupt_Pin6, RISING ) ;
7173
attachInterrupt( 7, Interrupt_Pin7, CHANGE) ;
74+
75+
pcBuff = (char *)malloc(50);
76+
77+
strcpy(pcBuff, "CIAO");
78+
Serial.println("----");
79+
Serial.println(pcBuff); // Outputs garbage instead of "CIAO"
80+
Serial.println("----");
7281
}
7382

7483
static void led_step1( void )

Diff for: platform.txt

+19-14
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@ version=1.5.6
1212

1313
compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
1414
compiler.c.cmd=arm-none-eabi-gcc
15-
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf
15+
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf
1616
#-std=gnu99
17-
compiler.c.elf.cmd=arm-none-eabi-g++
18-
compiler.c.elf.flags=-Os -Wl,--gc-sections
17+
#compiler.c.elf.cmd=arm-none-eabi-g++
18+
compiler.c.elf.cmd=arm-none-eabi-gcc
19+
compiler.c.elf.flags=-Os -Wl,--gc-sections -save-temps
1920
compiler.S.flags=-c -g -x assembler-with-cpp
2021
compiler.cpp.cmd=arm-none-eabi-g++
21-
compiler.cpp.flags=-c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf
22+
compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf
2223
#-std=gnu++11
2324
compiler.ar.cmd=arm-none-eabi-ar
2425
compiler.ar.flags=rcs
2526
compiler.objcopy.cmd=arm-none-eabi-objcopy
2627
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
2728
compiler.elf2hex.flags=-O binary
2829
compiler.elf2hex.cmd=arm-none-eabi-objcopy
29-
compiler.ldflags=
30+
compiler.ldflags=-mcpu={build.mcu} -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
3031
compiler.size.cmd=arm-none-eabi-size
3132
compiler.define=-DARDUINO=
3233

@@ -36,6 +37,7 @@ build.extra_flags=
3637
# These can be overridden in platform.local.txt
3738
compiler.c.extra_flags=
3839
compiler.c.elf.extra_flags=
40+
#compiler.c.elf.extra_flags=-v
3941
compiler.cpp.extra_flags=
4042
compiler.ar.extra_flags=
4143
compiler.elf2hex.extra_flags=
@@ -55,16 +57,19 @@ build.usb_manufacturer="Unknown"
5557
# ---------------------
5658

5759
## Compile c files
58-
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}"
60+
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}"
5961

6062
## Compile c++ files
61-
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}"
63+
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}"
6264

6365
## Create archives
64-
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
66+
#recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/lib{archive_file}" "{object_file}"
67+
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/libarduino_core.a" "{object_file}"
6568

6669
## Combine gc-sections, archives, and objects
67-
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -save-temps -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" --specs=nano.specs "-L{build.path}" -Wl,--start-group -lm -lgcc -Wl,--end-group -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group {object_files} "{build.path}/{archive_file}" -Wl,--end-group
70+
#recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -save-temps -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" --specs=nano.specs "-L{build.path}" -mthumb {compiler.ldflags} {object_files} -Wl,--start-group -lm -lgcc "{build.path}/{archive_file}" -Wl,--end-group
71+
#recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" --specs=nano.specs {compiler.ldflags} {object_files} -Wl,--start-group -lm -lgcc -l{archive_file} -Wl,--end-group
72+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm -larduino_core -Wl,--end-group
6873

6974
## Create eeprom
7075
recipe.objcopy.eep.pattern=
@@ -105,16 +110,16 @@ tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{{{path}/share/
105110

106111
tools.openocd.program.params.verbose=-d3
107112
tools.openocd.program.params.quiet=-d0
108-
tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -v
113+
tools.openocd.program.pattern=
109114

110115
tools.openocd.erase.params.verbose=-d3
111116
tools.openocd.erase.params.quiet=-d0
112-
tools.openocd.erase.pattern="{path}/{cmd}" {erase.verbose} -v
117+
tools.openocd.erase.pattern=
113118

114-
tools.openocd.bootloader.params.verbose=-d3
119+
tools.openocd.bootloader.params.verbose=-d2
115120
tools.openocd.bootloader.params.quiet=-d0
116-
#tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{{path}/share/openocd/scripts/}" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset"
117-
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "../../../../../arduino/samd/variants/{build.variant}/{build.openocdscript}" -c "program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset"
121+
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{{path}/share/openocd/scripts/}" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset"
122+
#tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "../../../../../arduino/samd/variants/{build.variant}/{build.openocdscript}" -c "program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset"
118123

119124
#
120125
# OpenOCD burn bootloader

Diff for: variants/arduino_zero/linker_scripts/gcc/flash.ld

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ MEMORY
5858
* __StackLimit
5959
* __StackTop
6060
* __stack
61+
* __ram_end__
6162
*/
6263
ENTRY(Reset_Handler)
6364

Diff for: variants/arduino_zero/variant.h

-7
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@
4444
extern "C"{
4545
#endif // __cplusplus
4646

47-
/**
48-
* Libc porting layers
49-
*/
50-
#if defined ( __GNUC__ )
51-
# include <syscalls.h> /** RedHat Newlib minimal stub */
52-
#endif
53-
5447
/*----------------------------------------------------------------------------
5548
* Pins
5649
*----------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)