add a Makefile for FreeBSD users

re-enable sleep mode
This commit is contained in:
Oliver Lehmann 2012-06-06 23:10:31 +00:00
parent 8576a53f28
commit 546554bcda
2 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,36 @@
OUTPUT_FILE=P8000_WDC_Emulator
MCU= -mmcu=atmega1284p
CC=avr-gcc
CFLAGS= -I/usr/local/avr/include -funsigned-char -funsigned-bitfields -O1 \
-ffunction-sections -fpack-struct -fshort-enums -Wall -Wundef \
-Werror -pedantic -pedantic-errors -c -std=gnu99 ${MCU}
LDFLAGS=-Wl,-Map="${OUTPUT_FILE}.map" -Wl,--start-group -Wl,-lm \
-Wl,--end-group -Wl,--gc-sections -mrelax ${MCU}
RM := rm -rf
OBJS += \
main.o \
mmc.o \
uart.o \
wdc_if_pio.o \
wdc_if_sdcard.o \
wdc_par.o \
wdc_ram.o
all: ${OUTPUT_FILE}
${OUTPUT_FILE}: ${OBJS}
avr-gcc -o${OUTPUT_FILE}.elf ${OBJS} ${LDFLAGS}
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature "${OUTPUT_FILE}.elf" "${OUTPUT_FILE}.hex"
avr-objcopy -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "${OUTPUT_FILE}.elf" "${OUTPUT_FILE}.eep" || exit 0
avr-objdump -h -S "${OUTPUT_FILE}.elf" > "${OUTPUT_FILE}.lss"
avr-size "${OUTPUT_FILE}.elf"
clean:
-${RM} ${OBJS}
rm -rf "${OUTPUT_FILE}.elf" "${OUTPUT_FILE}.a" "${OUTPUT_FILE}.hex" "${OUTPUT_FILE}.lss" "${OUTPUT_FILE}.eep" "${OUTPUT_FILE}.map"

View File

@ -1,7 +1,7 @@
/* /*
* P8000 WDC Emulator * P8000 WDC Emulator
* *
* $Id: wdc_main.c,v 1.13 2012/06/06 22:05:06 olivleh1 Exp $ * $Id: wdc_main.c,v 1.14 2012/06/06 23:10:31 olivleh1 Exp $
* *
* TODO: - Different Errorcodes in the MMC layer (use defines) * TODO: - Different Errorcodes in the MMC layer (use defines)
* - errorchecking in several places * - errorchecking in several places
@ -341,7 +341,7 @@ main ( void )
void atmega_setup ( void ) void atmega_setup ( void )
{ {
// set_sleep_mode ( SLEEP_MODE_IDLE ); set_sleep_mode ( SLEEP_MODE_IDLE );
uart_init(); uart_init();
wdc_init_ports(); wdc_init_ports();
while ( wdc_init_sdcard() ) { while ( wdc_init_sdcard() ) {