-
-
Save Madsy/282991 to your computer and use it in GitHub Desktop.
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
#include "lpc2103.h" // LPC2103 MPU Register | |
/* pototype section */ | |
void delay_led(unsigned long int); // Delay Time Function | |
int main(void) | |
{ | |
unsigned long int LED; // LED Output Status Buffer | |
// Initial all GPIO-0 = Output | |
// Reserve P0.0 = TXD(UART0) | |
// Reserve P0.1 = RXD(UART0) | |
// [xxxx xxxx xxxx xxxx xxxx xxxx xxxx xx--] | |
PINSEL0 = 0x00000000; // Makesure GPIO0[00..15] = GPIO Function | |
PINSEL1 = 0x00000000; // Makesure GPIO0[16..31] = GPIO Function | |
IODIR = 0xFFFFFFFC; // Set all GPIO-0[02..31] = Output | |
IOSET = 0xFFFFFFFC; // Set all GPIO-0 Output Pin(OFF LED) | |
// Loop Test Output GPI0-0 // | |
while(1) // Loop Continue | |
{ | |
// GPIO0.31 <-- GPIO0.2 | |
for (LED = 0x00000004; LED < 0x80000000; LED <<= 1) // Shift Left GPIO-0 (Right <- Left) | |
{ | |
IOCLR = LED; // Clear Output Pin (ON LED) | |
delay_led(10000000); // Display Delay | |
IOSET = LED; // Set Output Pin (OFF LED) | |
} | |
// GPIO0.31 ---> GPIO0.2 | |
for (LED = 0x80000000; LED > 0x00000004; LED >>= 1) // Shift Right GPIO-0(Right -> Left) | |
{ | |
IOCLR = LED; // Clear Output Pin (ON LED) | |
delay_led(10000000); // Display Delay | |
IOSET = LED; // Set Output Pin (OFF LED) | |
} | |
} | |
} | |
/***********************/ | |
/* Delay Time Function */ | |
/* 1-4294967296 */ | |
/***********************/ | |
void delay_led(unsigned long int count1) | |
{ | |
while(count1 > 0) {count1--;} // Loop Decrease Counter | |
} | |
//******************************************************************************************** | |
Make file | |
################################################################################ | |
# Automatically-generated file. Do not edit! | |
################################################################################ | |
-include ../makefile.init | |
RM := rm -rf | |
# All of the sources participating in the build are defined here | |
-include sources.mk | |
-include subdir.mk | |
-include objects.mk | |
ifneq ($(MAKECMDGOALS),clean) | |
ifneq ($(strip $(C_DEPS)),) | |
-include $(C_DEPS) | |
endif | |
ifneq ($(strip $(ASM_DEPS)),) | |
-include $(ASM_DEPS) | |
endif | |
ifneq ($(strip $(S_UPPER_DEPS)),) | |
-include $(S_UPPER_DEPS) | |
endif | |
endif | |
-include ../makefile.defs | |
# Add inputs and outputs from these tool invocations to the build variables | |
SECONDARY_FLASH += \ | |
armer.hex \ | |
SECONDARY_LIST += \ | |
armer.lst \ | |
SECONDARY_SIZE += \ | |
armer.siz \ | |
# All Target | |
all: armer.elf secondary-outputs | |
# Tool invocations | |
armer.elf: $(OBJS) $(USER_OBJS) | |
@echo 'Building target: $@' | |
@echo 'Invoking: ARM Sourcery Linux GCC C Linker' | |
@@arm-none-linux-gnueabi-gcc -nodefaultlibs -Wl,-Map,armer.map -mcpu=arm7tdmi -mthumb -g3 -gdwarf-2 -o"armer.elf" $(OBJS) $(USER_OBJS) $(LIBS) | |
arm-none-linux-gnueabi-gcc -ffreestanding -Wl,-Map,armer.map -Wl,-e,main -mapcs-32,-mabi=aapcs-linux -mcpu=arm7tdmi -mthumb -g3 -gdwarf-2 -o armer.elf $(OBJS) $(USER_OBJS) $(LIBS) | |
@echo 'Finished building target: $@' | |
@echo ' ' | |
armer.hex: armer.elf | |
@echo 'Invoking: ARM Sourcery Linux GNU Create Flash Image' | |
arm-none-linux-gnueabi-objcopy -O ihex armer.elf "armer.hex" | |
@echo 'Finished building: $@' | |
@echo ' ' | |
armer.lst: armer.elf | |
@echo 'Invoking: ARM Sourcery Linux GNU Create Listing' | |
arm-none-linux-gnueabi-objdump -h -S armer.elf >"armer.lst" | |
@echo 'Finished building: $@' | |
@echo ' ' | |
armer.siz: armer.elf | |
@echo 'Invoking: ARM Sourcery Linux GNU Print Size' | |
arm-none-linux-gnueabi-size --format=berkeley armer.elf | |
@echo 'Finished building: $@' | |
@echo ' ' | |
# Other Targets | |
clean: | |
-$(RM) $(SECONDARY_SIZE)$(OBJS)$(C_DEPS)$(ASM_DEPS)$(SECONDARY_FLASH)$(EXECUTABLES)$(SECONDARY_LIST)$(S_UPPER_DEPS) armer.elf | |
-@echo ' ' | |
secondary-outputs: $(SECONDARY_FLASH) $(SECONDARY_LIST) $(SECONDARY_SIZE) | |
.PHONY: all clean dependents | |
.SECONDARY: | |
-include ../makefile.targets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment