Skip to content

Commit

Permalink
Merge pull request #9984 from kaspar030/refactor_atmega_libc
Browse files Browse the repository at this point in the history
cpu/atmega_common: refactor AVR libc code into module
  • Loading branch information
smlng authored Jan 22, 2019
2 parents e22e582 + 7313525 commit 0edf76d
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions boards/common/atmega/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ void led_init(void);

void board_init(void)
{

atmega_set_prescaler(CPU_ATMEGA_CLK_SCALE_INIT);

#ifdef MODULE_AVR_LIBC_EXTRA
atmega_stdio_init();
#endif

cpu_init();
led_init();
irq_enable();
Expand Down
3 changes: 3 additions & 0 deletions boards/waspmote-pro/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ void board_init(void)
#endif
#endif

#ifdef MODULE_AVR_LIBC_EXTRA
atmega_stdio_init();
#endif

cpu_init();
led_init();
irq_enable();
Expand Down
2 changes: 1 addition & 1 deletion cpu/atmega_common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
MODULE = atmega_common

# add a list of subdirectories, that should also be build
DIRS = periph
DIRS = periph avr_libc_extra

include $(RIOTBASE)/Makefile.base
7 changes: 6 additions & 1 deletion cpu/atmega_common/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export USEMODULE += periph_common
export USEMODULE += stdio_uart

# include module specific includes
export INCLUDES += -I$(RIOTCPU)/atmega_common/include -isystem$(RIOTCPU)/atmega_common/include/vendor
export INCLUDES += -I$(RIOTCPU)/atmega_common/include \
-isystem$(RIOTCPU)/atmega_common/avr_libc_extra/include \
-isystem$(RIOTCPU)/atmega_common/avr_libc_extra/include/vendor

ifeq ($(LTO),1)
# avr-gcc <4.8.3 has a bug when using LTO which causes a warning to be printed always:
Expand All @@ -37,3 +39,6 @@ LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__DATA_REGION_LENGTH__=$(RAM_LEN)
LDSCRIPT_COMPAT = $(if $(shell $(TARGET_ARCH)-ld --verbose | grep __TEXT_REGION_LENGTH__),,\
-T$(RIOTCPU)/$(CPU)/ldscripts_compat/avr_2.26.ld)
LINKFLAGS += $(LDSCRIPT_COMPAT)

# avr libc needs some RIOT-specific support code
USEMODULE += avr_libc_extra
1 change: 1 addition & 0 deletions cpu/atmega_common/avr_libc_extra/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(RIOTBASE)/Makefile.base
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0edf76d

Please sign in to comment.