Skip to content

Commit e84df81

Browse files
committed
Restored assert on gpio_object.h. Added export template for GCC ARM Embedded (TOOLCHAIN_GCC_ARM)
1 parent 9b8711e commit e84df81

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#ifndef MBED_GPIO_OBJECT_H
1717
#define MBED_GPIO_OBJECT_H
1818

19+
#include "mbed_assert.h"
20+
1921
#ifdef __cplusplus
2022
extern "C" {
2123
#endif
@@ -31,13 +33,15 @@ typedef struct {
3133
} gpio_t;
3234

3335
static inline void gpio_write(gpio_t *obj, int value) {
36+
MBED_ASSERT(obj->pin != (PinName)NC);
3437
if (value)
3538
*obj->reg_set = obj->mask;
3639
else
3740
*obj->reg_clr = obj->mask;
3841
}
3942

4043
static inline int gpio_read(gpio_t *obj) {
44+
MBED_ASSERT(obj->pin != (PinName)NC);
4145
return ((*obj->reg_in & obj->mask) ? 1 : 0);
4246
}
4347

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This file was automagically generated by mbed.org. For more information,
2+
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
3+
4+
GCC_BIN =
5+
PROJECT = {{name}}
6+
OBJECTS = {% for f in to_be_compiled %}{{f}} {% endfor %}
7+
SYS_OBJECTS = {% for f in object_files %}{{f}} {% endfor %}
8+
INCLUDE_PATHS = {% for p in include_paths %}-I{{p}} {% endfor %}
9+
LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %}
10+
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
11+
LINKER_SCRIPT = {{linker_script}}
12+
13+
###############################################################################
14+
AS = $(GCC_BIN)arm-none-eabi-as
15+
CC = $(GCC_BIN)arm-none-eabi-gcc
16+
CPP = $(GCC_BIN)arm-none-eabi-g++
17+
LD = $(GCC_BIN)arm-none-eabi-gcc
18+
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
19+
20+
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
21+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
22+
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
23+
24+
LD_FLAGS = -mcpu=cortex-m4 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
25+
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
26+
27+
ifeq ($(DEBUG), 1)
28+
CC_FLAGS += -DDEBUG -O0
29+
else
30+
CC_FLAGS += -DNDEBUG -Os
31+
endif
32+
33+
all: $(PROJECT).bin
34+
35+
clean:
36+
rm -f $(PROJECT).bin $(PROJECT).elf $(OBJECTS)
37+
38+
.s.o:
39+
$(AS) $(CPU) -o $@ $<
40+
41+
.c.o:
42+
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<
43+
44+
.cpp.o:
45+
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $<
46+
47+
48+
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
49+
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
50+
51+
$(PROJECT).bin: $(PROJECT).elf
52+
$(OBJCOPY) -O binary $< $@

0 commit comments

Comments
 (0)