Skip to content

Commit

Permalink
Added support for SDCC and did a clean-up since it has been a long ti…
Browse files Browse the repository at this point in the history
…me (close to 4 years !)

- Added Keil µVision project file
- Updated README.md
- Added .gitignore
  • Loading branch information
jabezwinston committed Dec 27, 2019
1 parent 28c954f commit bf75721
Show file tree
Hide file tree
Showing 5 changed files with 522 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Listings/
Objects/
build/
*.hex
*.ihx
*.bin
*.rel
*.lst
*.map
*.uvgui.*
*.uvopt
*.pdsprj.*.workspace
78 changes: 78 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
############ Tools #########################

CC = sdcc
AS = sdas8051
LD = sdld
HEX_TOOL = packihx
BIN_TOOL = makebin

############# Project Settings ##############

OUTPUT = Race_stop_watch

ASM_SRCS +=

C_SRCS += main.c

INCLUDE_PATHS +=

########## Compiler/Linker Flags ############

ASMFLAGS += -l -o

CFLAGS += -mmcs51 -c

LDFLAGS +=

#############################################

OBJ_DIR = build

C_FILES = $(notdir $(C_SRCS))
C_OBJS = $(addprefix $(OBJ_DIR)/, $(C_FILES:.c=.rel))
C_PATHS = $(sort $(dir $(C_SRCS)))
vpath %.c $(C_PATHS)

ASM_OBJS = $(ASM_SRCS:.asm=.rel)
ASM_PATHS = $(sort $(dir $(ASM_SRCS)))
vpath %.asm $(ASM_PATHS)

OBJS = $(C_OBJS) $(ASM_OBJS)

IHX = $(OBJ_DIR)/$(OUTPUT).ihx

HEX = $(OUTPUT).hex
BIN = $(OUTPUT).bin

############## Make targets #################

all: $(HEX) $(IHX) $(BIN)

$(BIN) : $(HEX)
@echo [ BIN ] $@
@$(BIN_TOOL) -p "$<" "$@"

$(HEX) : $(IHX)
@echo [ HEX ] $@
@$(HEX_TOOL) "$<" > "$@"

$(OBJ_DIR):
@echo [ MKDIR ] $@
@mkdir "$@"

$(IHX): $(OBJ_DIR) $(OBJS)
@echo [ LD ] $@
@$(CC) $(LDFLAGS) -o $@ $(OBJS)

$(OBJ_DIR)/%.rel: %.c
@echo [ CC ] $<
@$(CC) $(CFLAGS) $(addprefix -I,$(INCLUDEPATHS)) -o "$@" "$<"

%.rel: %.asm
@echo [ AS ] $<
@$(AS) $(ASMFLAGS) $<

clean:
rm -rf $(OBJ_DIR) $(HEX) $(BIN) $(ASM_OBJS) *.rel *.lst *.rst


30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
Open race_stop_watch.pdsprj using Proteus 8. Just click play button to run the simulation.
# Race Stop Watch

Source code is found in main.c
If you are modifying the code,compile the code and generate HEX file Keil µVision IDE (C51)
Use the modified HEX file to run the simulation.
Open `race_stop_watch.pdsprj` using Proteus 8. Just click play button to run the simulation.

Code can be compiled with either Keil µVision IDE (C51) or SDCC
- Keil µVision IDE (C51)
- Download and install [Keil C51](http://www.keil.com/c51/)
- Open `Race_stop_watch.uvproj` and click `Build`
- SDCC
- Install [SDCC](http://sdcc.sourceforge.net/)
- Windows - Get [MSYS2](https://www.msys2.org/) and SDCC
[32-bit installer](https://sourceforge.net/projects/sdcc/files/snapshot_builds/i586-mingw32msvc-setup/)/
[64-bit installer](https://sourceforge.net/projects/sdcc/files/snapshot_builds/x86_64-w64-mingw32-setup/)
- Debian based (Eg: Ubuntu) - `sudo apt install sdcc`
- macOS - `brew install sdcc`
- Run `make`

Use the generated HEX file `Race_stop_watch.hex` to run the Proteus simulation.

![Race Stop Watch](Screenshot_Proteus_simulation.JPG)

---

## Changelog

- March 2016 - Initial version
- December 2019 - Added support for SDCC
Loading

0 comments on commit bf75721

Please sign in to comment.