From 5868219894fe3fc15cb165608de5a35711064114 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Wed, 23 Nov 2016 09:59:16 +0000 Subject: [PATCH] misc: Spacing cleanup Trailing space removal Signed-off-by: Michel Pollet --- Makefile.common | 20 ++++++++++---------- simavr/sim/avr_extint.c | 2 +- simavr/sim/run_avr.c | 8 ++++---- simavr/sim/sim_avr.c | 3 ++- simavr/sim/sim_avr.h | 34 +++++++++++++++++----------------- simavr/sim/sim_core.h | 12 ++++++------ 6 files changed, 40 insertions(+), 39 deletions(-) diff --git a/Makefile.common b/Makefile.common index edbd49c..751e601 100644 --- a/Makefile.common +++ b/Makefile.common @@ -2,13 +2,13 @@ # This makefile take each "at*" file, extracts it's part name # And compile it into an ELF binary. # It also disassemble it for debugging purposes. -# +# # The code is compiled "optimized" to the max. -# +# # The weird "-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000" # is used to tell the linker not to discard the .mmcu section, # otherwise the --gc-sections will delete it. -# +# # Copyright 2008, 2009 Michel Pollet # # This file is part of simavr. @@ -44,7 +44,7 @@ CFLAGS += -g CORE_CFLAGS = -nostdinc -DAVR_CORE=1 ifeq (${shell uname}, Darwin) - # gcc 4.2 from MacOS is really not up to scratch anymore + # gcc 4.2 from MacOS is really not up to scratch anymore CC = clang AVR_ROOT := "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/" AVR_INC := ${AVR_ROOT}/avr/ @@ -117,12 +117,12 @@ RANLIB ?= ranlib MKDIR ?= mkdir -p INSTALL ?= install SHELL := ${shell which bash} - + OBJ := obj-${shell $(CC) -dumpmachine} LIBDIR := ${shell pwd}/${SIMAVR}/${OBJ} LDFLAGS += -L${LIBDIR} -lsimavr -lm -LDFLAGS += -lelf +LDFLAGS += -lelf ifeq (${WIN}, Msys) LDFLAGS += -lws2_32 @@ -140,7 +140,7 @@ endif endif # The code is compiled "optimized" to the max. -# +# # The weird "-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000" # is used to tell the linker not to discard the .mmcu section, # otherwise the --gc-sections will delete it. @@ -152,7 +152,7 @@ endif @${AVR}objdump -j .text -j .data -j .bss -d ${<} > ${@} # --mcall-prologues can be used here, but messes up debugging a little -%.axf: %.c +%.axf: %.c @echo AVR-CC ${<} @part=${<} ; part=$${part/_*}; \ ${AVR}gcc -Wall -gdwarf-2 -Os -std=gnu99 \ @@ -198,8 +198,8 @@ else endif obj: ${OBJ} - -${OBJ}: + +${OBJ}: @mkdir -p ${OBJ} clean-${OBJ}: diff --git a/simavr/sim/avr_extint.c b/simavr/sim/avr_extint.c index 2d6dbbb..2e3c6fb 100644 --- a/simavr/sim/avr_extint.c +++ b/simavr/sim/avr_extint.c @@ -192,7 +192,7 @@ static void avr_extint_reset(avr_io_t * port) avr_irq_t * irq = avr_io_getirq(p->io.avr, p->eint[i].port_ioctl, p->eint[i].port_pin); - avr_connect_irq(irq, p->io.irq + i); + avr_connect_irq(irq, p->io.irq + i); } } } diff --git a/simavr/sim/run_avr.c b/simavr/sim/run_avr.c index 87cda9f..6841f8b 100644 --- a/simavr/sim/run_avr.c +++ b/simavr/sim/run_avr.c @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) } else if (!strcmp(argv[pi], "-ee")) { loadBase = AVR_SEGMENT_OFFSET_EEPROM; } else if (!strcmp(argv[pi], "-ff")) { - loadBase = AVR_SEGMENT_OFFSET_FLASH; + loadBase = AVR_SEGMENT_OFFSET_FLASH; } else if (argv[pi][0] != '-') { char * filename = argv[pi]; char * suffix = strrchr(filename, '.'); @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) ihex_chunk_p chunk = NULL; int cnt = read_ihex_chunks(filename, &chunk); if (cnt <= 0) { - fprintf(stderr, "%s: Unable to load IHEX file %s\n", + fprintf(stderr, "%s: Unable to load IHEX file %s\n", argv[0], argv[pi]); exit(1); } @@ -189,9 +189,9 @@ int main(int argc, char *argv[]) for (;;) { int state = avr_run(avr); - if ( state == cpu_Done || state == cpu_Crashed) + if (state == cpu_Done || state == cpu_Crashed) break; } - + avr_terminate(avr); } diff --git a/simavr/sim/sim_avr.c b/simavr/sim/sim_avr.c index 8551e5c..2a145ab 100644 --- a/simavr/sim/sim_avr.c +++ b/simavr/sim/sim_avr.c @@ -319,7 +319,8 @@ void avr_callback_run_raw(avr_t * avr) /* Note: checking interrupt_state here is completely superfluous, however as interrupt_state tells us all we really need to know, here a simple check here may be cheaper than a call not needed. */ - if (avr->interrupt_state) avr_service_interrupts(avr); + if (avr->interrupt_state) + avr_service_interrupts(avr); } } diff --git a/simavr/sim/sim_avr.h b/simavr/sim/sim_avr.h index 00ad9b7..87c5e72 100644 --- a/simavr/sim/sim_avr.h +++ b/simavr/sim/sim_avr.h @@ -145,18 +145,18 @@ typedef void (*avr_run_t)( * the rest is runtime data (as little as possible) */ typedef struct avr_t { - const char * mmcu; // name of the AVR + const char * mmcu; // name of the AVR // these are filled by sim_core_declare from constants in /usr/lib/avr/include/avr/io*.h - uint16_t ramend; - uint32_t flashend; - uint32_t e2end; - uint8_t vector_size; - uint8_t signature[3]; - uint8_t fuse[6]; - uint8_t lockbits; - avr_io_addr_t rampz; // optional, only for ELPM/SPM on >64Kb cores - avr_io_addr_t eind; // optional, only for EIJMP/EICALL on >64Kb cores - uint8_t address_size; // 2, or 3 for cores >128KB in flash + uint16_t ramend; + uint32_t flashend; + uint32_t e2end; + uint8_t vector_size; + uint8_t signature[3]; + uint8_t fuse[6]; + uint8_t lockbits; + avr_io_addr_t rampz; // optional, only for ELPM/SPM on >64Kb cores + avr_io_addr_t eind; // optional, only for EIJMP/EICALL on >64Kb cores + uint8_t address_size; // 2, or 3 for cores >128KB in flash // filled by the ELF data, this allow tracking of invalid jumps uint32_t codeend; @@ -181,7 +181,7 @@ typedef struct avr_t { * is reached, at which point sleep_usec is cleared and the sleep request * is passed on to the operating system. */ - uint32_t sleep_usec; + uint32_t sleep_usec; // called at init time void (*init)(struct avr_t * avr); @@ -228,7 +228,7 @@ typedef struct avr_t { 00: idle (no wait, no pending interrupts) or disabled <0: wait till zero >0: interrupt pending */ - int8_t interrupt_state; // interrupt state + int8_t interrupt_state; // interrupt state /* * ** current PC ** @@ -274,7 +274,7 @@ typedef struct avr_t { * will handle this particular case, without impacting the performance of the * other, normal cases... */ - int io_shared_io_count; + int io_shared_io_count; struct { int used; struct { @@ -284,12 +284,12 @@ typedef struct avr_t { } io_shared_io[4]; // flash memory (initialized to 0xff, and code loaded into it) - uint8_t * flash; + uint8_t * flash; // this is the general purpose registers, IO registers, and SRAM - uint8_t * data; + uint8_t * data; // queue of io modules - struct avr_io_t *io_port; + struct avr_io_t * io_port; // Builtin and user-defined commands avr_cmd_table_t commands; diff --git a/simavr/sim/sim_core.h b/simavr/sim/sim_core.h index 51c4ecd..fa99638 100644 --- a/simavr/sim/sim_core.h +++ b/simavr/sim/sim_core.h @@ -28,8 +28,8 @@ extern "C" { #ifdef NO_COLOR #define FONT_GREEN - #define FONT_RED - #define FONT_DEFAULT + #define FONT_RED + #define FONT_DEFAULT #else #define FONT_GREEN "\e[32m" #define FONT_RED "\e[31m" @@ -55,8 +55,8 @@ int _avr_push_addr(avr_t * avr, avr_flashaddr_t addr); */ const char * avr_regname(uint8_t reg); -/* - * DEBUG bits follow +/* + * DEBUG bits follow * These will disappear when gdb arrives */ void avr_dump_state(avr_t * avr); @@ -88,7 +88,7 @@ void avr_dump_state(avr_t * avr); #define DUMP_STACK() #define DUMP_REG(); -#endif +#endif /** * Reconstructs the SREG value from avr->sreg into dst. @@ -104,7 +104,7 @@ void avr_dump_state(avr_t * avr); static inline void avr_sreg_set(avr_t * avr, uint8_t flag, uint8_t ival) { - /* + /* * clear interrupt_state if disabling interrupts. * set wait if enabling interrupts. * no change if interrupt flag does not change. -- 2.39.5