This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** ../CMSIS_5/Device/ARM/ARMCM3/Source/GCC/gcc_arm.ld 2017-03-09 18:07:02.000000000 -0500 | |
--- LPC1768.ld 2017-03-09 18:53:18.000000000 -0500 | |
*************** | |
*** 2,8 **** | |
MEMORY | |
{ | |
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K | |
! RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256K | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define P1_18_SEL (1 << 5) | (1 << 4) /* Pin 1.18 = LED1 */ | |
#define P1_20_SEL (1 << 9) | (1 << 8) /* Pin 1.20 = LED2 */ | |
#define P1_21_SEL (1 << 11) | (1 << 10) /* Pin 1.21 = LED3 */ | |
#define P1_23_SEL (1 << 15) | (1 << 14) /* Pin 1.23 = LED4 */ | |
... | |
/* Set the pins to GPIO by setting the associated bits to 00 (p119) | |
*/ | |
LPC_PINCON->PINSEL3 &= (unsigned) ~(P1_18_SEL | P1_20_SEL | P1_21_SEL | P1_23_SEL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define P18 (1 << 18) | |
#define P20 (1 << 20) | |
#define P21 (1 << 21) | |
#define P23 (1 << 23) | |
#define ALL (P18 | P20 | P21 | P23) | |
... | |
/* Set the direction as output by setting the associated bits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Turn the LEDs on and off at roughly 1Hz. | |
*/ | |
while (1) { | |
LPC_GPIO1->FIOSET |= ALL; /* p132 */ | |
delay_ms(500); | |
LPC_GPIO1->FIOCLR |= ALL; /* p132 */ | |
delay_ms(500); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/ARM-Options.html | |
ARM_FLAGS = \ | |
-mthumb \ | |
-mcpu=cortex-m3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Warning-Options.html | |
WARNING_FLAGS = \ | |
-Wall \ | |
-Wextra \ | |
-pedantic \ | |
-Wbad-function-cast \ | |
-Wconversion \ | |
-Wfloat-equal \ | |
-Wlogical-op \ | |
-Wmissing-declarations \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Preprocessor-Options.html | |
CPPFLAGS = \ | |
-MMD \ | |
-MF"$(@:%.o=%.d)" \ | |
-MT"$(@)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define DEBUG to anything if you want debug enabled. | |
# | |
# https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Optimize-Options.html#Optimize-Options | |
# http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0205g/Bgbjjgij.html | |
# https://mcuoneclipse.com/2015/05/27/semihosting-for-kinetis-design-studio-v3-0-0-and-gnu-arm-embedded-launchpad/ | |
DEBUG= | |
ifdef DEBUG | |
OPTIMIZE=-Os -g -DDEBUG | |
RDIMONSPECS = --specs=rdimon.specs | |
RDIMONLIB = -lrdimon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Diagnostic-Message-Formatting-Options.html | |
# https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/C-Dialect-Options.html#C-Dialect-Options | |
# https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Code-Gen-Options.html | |
ASFLAGS = \ | |
$(ARM_FLAGS) \ | |
$(WARNING_FLAGS) \ | |
-fmessage-length=0 \ | |
$(OPTIMIZE) \ | |
-ffunction-sections \ | |
-fdata-sections \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Link-Options.html | |
LDFLAGS = \ | |
-nodefaultlibs \ | |
-T "LPC1768.ld" \ | |
-Wl,--gc-sections \ | |
-Wl,-Map,"BBB.map" \ | |
-Wl,--start-group -lgcc -lc -lm $(RDIMONLIB) -Wl,--end-group |
OlderNewer