Browse Source

Merge remote-tracking branch 'origin' into kart

feature/2015
Stefan Kinzel 11 years ago
parent
commit
057160a298
  1. 2
      Makefile
  2. 86
      README.md
  3. 37
      defaults.mk
  4. 200
      ld_scripts/elf_i386_nbsd.x
  5. 219
      ld_scripts/elf_x86_64_nbsd.x
  6. 5
      profiles/LoL-Shield_Leonardo
  7. 128
      profiles/LoL-Shield_Mega1280
  8. 1
      profiles/LoL-Shield_Mega2560
  9. 1
      profiles/LoL-Shield_Uno-Duemilanove-Diavolino
  10. 8
      scripts/lxdialog/Makefile
  11. 149
      src/borg_hw/borg_hw_lolshield.c
  12. 1
      src/borg_hw/config_lolshield.in
  13. 1
      src/games/snake/snake_game.c
  14. 4
      src/rfm12/rfm12_config.h
  15. 2
      src/rfm12/rfm12_lib

2
Makefile

@ -170,7 +170,7 @@ clean:
$(MAKE) -f rules.mk no_deps=t clean-common
$(RM) -f $(TARGET) $(TARGET).bin $(TARGET).hex $(TARGET).lst .subdirs
$(RM) -f $(TARGET).map
for subdir in `find . -type d ! -iwholename './src/rfm12/rfm12_lib/examples/*'` ; do \
for subdir in `find . -type d ! -regex './src/rfm12/rfm12_lib/examples/.*'` ; do \
test "x$$subdir" != "x." \
&& test -e $$subdir/Makefile \
&& $(MAKE) no_deps=t -C $$subdir clean ; done ; true

86
README.md

@ -41,25 +41,26 @@ Games
Build
=====
Supported build platforms are Linux, FreeBSD and Windows (via Cygwin). Due to
customized linker scripts, simulator support is currently limited to x86 and
x86_64 archs. Following dependencies have to be met:
Supported build platforms are Linux, FreeBSD, NetBSD and Windows (via Cygwin).
Due to customized linker scripts, simulator support is currently limited to x86
and x86_64 archs. Following dependencies have to be met:
Linux / FreeBSD
---------------
Linux / FreeBSD / NetBSD
------------------------
Package names are based on Debian/Ubuntu repositories. Please adapt the names
according to your Linux distribution (or FreeBSD for that matter).
according to your Linux distribution (or BSD for that matter).
* build-essential (pulls in an ordinary gcc build tool chain for the host)
* bc
* make (gmake on FreeBSD)
* make (gmake on BSD)
* libncurses5-dev
* gcc-avr
* avr-libc
* binutils-avr
* avrdude
* freeglut3-dev
* bash (note to the BSD folks: bash is required for the config tool)
Windows
-------
@ -90,12 +91,21 @@ Configure
Open a (Cygwin) terminal, change to your checkout directory and type:
> make menuconfig
This starts a curses based text interface for configuring certain aspects of
your target platform. Be careful if you use an IDE like Eclipse to manage the
build, as integrated terminal emulators tend to choke on curses generated shell
output. Make sure that 'make menuconfig' has been run at least once in an
ordinary terminal emulator after a fresh checkout or after issuing 'make
mrproper'.
In case you build on BSD, just use 'gmake' instead of 'make'. This starts an
Ncurses based text interface for configuring certain aspects of your target
platform. After a fresh checkout, the first thing you do is to load a profile
with sane defaults. In the menuconfig interface, select 'Load a Default
Configuration' and choose a preset. After hitting enter, the main menu returns
immediately. You can either tune your configuration or just exit (choose 'Yes'
at the confirmation dialog to save your stuff).
Be careful if you use an IDE like Eclipse to manage the build, as
integrated terminal emulators tend to choke on Ncurses generated output.
Make sure that 'make menuconfig' has been run at least once in an ordinary
terminal emulator after a fresh checkout or after issuing 'make mrproper'.
Note: Always use 'make clean' after changing something in the menu, because
subsequent builds may be broken if you don't.
Compile
-------
@ -103,11 +113,13 @@ Compile
To build for the actual target platform, just type:
> make
This yields an 'image.hex' file which you can flash to your AVR device.
If you want to test and debug your code within a GUI application, you can use
the simulator:
> make simulator
In case you build on FreeBSD, just use 'gmake' instead of 'make'.
Again, use 'gmake' instead of 'make' on BSD.
You can start the simulator by typing ./borgsim(.exe)
@ -116,9 +128,47 @@ Simulator Handling
Please keep in mind that the simulator is NOT an emulator. All it does is
compile the source code to a native host application so you can step through
your C-Code. The GUI thread reads the simulated frame buffer every 40ms and
draws its contents.
your C-Code with an ordinary host debugger. The GUI thread reads the simulated
frame buffer every 20ms (40ms on Windows) and draws its contents.
Joystick directions are simulated by the WASD keys and SPACE acts as the fire
button. The OpenGL based simulator (Linux/FreeBSD) enables you to adjust the
Joystick movements are simulated by the WASD keys and SPACE acts as the fire
button. The OpenGL based simulator (Linux/BSD) enables you to adjust the
viewing angle of the LED matrix via the arrow keys (not available on Windows).
LoL Shield on Arduino (and clones)
----------------------------------
Although this project supports the LoL Shield on various Arduino boards, it does
not use the Arduino software stack at all. Instead, it follows the classical
Unix approach involving make files and mere command line tools. If you haven't
used anything besides the Arduino IDE, getting the Borgware to run (let alone
extending it) might be difficult at first. This README won't even try to cover
all workflows involved.
However, here are some hints:
* Find out what 'avrdude' command line parameters are used by the Arduino IDE to
flash your device (look into the upload log). Use that parameters (with the -U
option pointing to the Borgware 'image.hex' file) to flash your board.
* Pay attention to the size of your image. Borgware 2D can easily be configured
to exceed the usable flash memory of a 32 KiB device. After a successful
build, both flash and SRAM usage are displayed. Keep in mind that stock
Arduino MCUs already reserve 0.5 to 4KiB of flash memory for bootloaders.
* Same with SRAM. The "data size" should not exceed 2KiB (make that 1.5 KiB as
we still need some additional SRAM at runtime).
* In case avrdude gives you a verification error, chances are that your image
already reaches the bootloader area in the flash. Try to disable some
animations or games in Menuconfig to trim your image.
Digital joysticks are supported on the 'analog' pins, which are used in digital
input mode with internal pullups turned on. Just connect them to GND to signal
joystick movements.
| Arduino Pin | Meaning |
| ----------- | ------------- |
| A0 | Up |
| A1 | Down |
| A2 | Left |
| A3 | Right |
| A4 | Not Connected |
| A5 | Fire |

37
defaults.mk

@ -40,7 +40,11 @@ ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN)
ifeq ($(MACHINE),x86_64)
LDFLAGS_SIM = -T ld_scripts/i386pep.x
else
ifeq ($(MACHINE),i686)
LDFLAGS_SIM = -T ld_scripts/i386pe.x
else
$(warning $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n))
endif
endif
LIBS_SIM = -lgdi32 -lwinmm -lm
else
@ -50,7 +54,25 @@ else
ifeq ($(MACHINE),amd64)
LDFLAGS_SIM = -L/usr/local/lib -T ld_scripts/elf_x86_64_fbsd.x
else
ifeq ($(MACHINE),i386)
LDFLAGS_SIM = -L/usr/local/lib -T ld_scripts/elf_i386_fbsd.x
else
$(warning $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n))
endif
endif
LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm
else
ifeq ($(OSTYPE),NetBSD)
CFLAGS_SIM = -g -I /usr/pkg/include -I/usr/X11R7/include -Wall -pedantic -std=c99 -O0
CFLAGS_SIM += -D_XOPEN_SOURCE=600
ifeq ($(MACHINE),amd64)
LDFLAGS_SIM = -L/usr/pkg/lib -L/usr/X11R7/lib -T ld_scripts/elf_x86_64_nbsd.x -Wl,-R/usr/pkg/lib,-R/usr/X11R7/lib
else
ifeq ($(MACHINE),i386)
LDFLAGS_SIM = -L/usr/pkg/lib -L/usr/X11R7/lib -T ld_scripts/elf_i386_nbsd.x -Wl,-R/usr/pkg/lib,-R/usr/X11R7/lib
else
$(warning $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n))
endif
endif
LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm
else
@ -59,19 +81,24 @@ else
ifeq ($(MACHINE),x86_64)
LDFLAGS_SIM = -T ld_scripts/elf_x86_64.x
else
ifeq ($(MACHINE),i686)
LDFLAGS_SIM = -T ld_scripts/elf_i386.x
else
$(warning $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n))
endif
endif
LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm
else
($(error $(n)$(n)Simulator build is not supported on your system.$(n)$(n)\
($(warning $(n)$(n)Simulator build is not supported on your system.$(n)$(n)\
Currently supported platforms:$(n) \
Linux on x86 and amd64$(n) \
FreeBSD on x86 and amd64$(n) \
Windows (through Cygwin) on x86 and amd64)
Linux on i386 and amd64$(n) \
FreeBSD on i386 and amd64$(n) \
NetBSD on i386 and amd64$(n) \
Windows (via Cygwin) on i386 and amd64)
endif
endif
endif
endif
##############################################################################
# the default target
$(TARGET):

200
ld_scripts/elf_i386_nbsd.x

@ -0,0 +1,200 @@
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
"elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR("=/usr/lib");
SECTIONS
{
/* Read-only sections, merged into text segment: */
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x08048000)); . = SEGMENT_START("text-segment", 0x08048000) + SIZEOF_HEADERS;
.interp : { *(.interp) }
.note.gnu.build-id : { *(.note.gnu.build-id) }
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.init : { *(.rel.init) }
.rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
.rel.fini : { *(.rel.fini) }
.rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
.rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
.rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
.rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
.rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
.rel.ctors : { *(.rel.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rel.got : { *(.rel.got) }
.rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
.rel.ifunc : { *(.rel.ifunc) }
.rel.plt :
{
*(.rel.plt)
PROVIDE_HIDDEN (__rel_iplt_start = .);
*(.rel.iplt)
PROVIDE_HIDDEN (__rel_iplt_end = .);
}
.init :
{
KEEP (*(.init))
} =0x90909090
.plt : { *(.plt) *(.iplt) }
.text :
{
PROVIDE_HIDDEN (__eprol = .);
*(.text.unlikely .text.*_unlikely)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} =0x90909090
.fini :
{
KEEP (*(.fini))
} =0x90909090
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
/* Exception handling */
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
/* Thread Local Storage sections */
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
}
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
}
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array))
PROVIDE_HIDDEN (__fini_array_end = .);
}
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
.dynamic : { *(.dynamic) }
.got : { *(.got) *(.igot) }
. = DATA_SEGMENT_RELRO_END (12, .);
.got.plt : { *(.got.plt) *(.igot.plt) }
.data :
{
*(.data .data.* .gnu.linkonce.d.*)
PROVIDE (_eeprom_start__ = .);
*(.eeprom)
. = ALIGN(4) ;
PROVIDE (_game_descriptors_start__ = .);
*(.game_descriptors)
PROVIDE (_game_descriptors_end__ = .);
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
_edata = .; PROVIDE (edata = .);
__bss_start = .;
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
FIXME: Why do we need it? When there is no .bss section, we don't
pad the .data section. */
. = ALIGN(. != 0 ? 32 / 8 : 1);
}
. = ALIGN(32 / 8);
. = ALIGN(32 / 8);
_end = .; PROVIDE (end = .);
. = DATA_SEGMENT_END (.);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* DWARF 3 */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { *(.debug_ranges) }
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
}

219
ld_scripts/elf_x86_64_nbsd.x

@ -0,0 +1,219 @@
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
"elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
SEARCH_DIR("/usr/lib");
SECTIONS
{
/* Read-only sections, merged into text segment: */
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;
.interp : { *(.interp) }
.note.gnu.build-id : { *(.note.gnu.build-id) }
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rela.init : { *(.rela.init) }
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
.rela.fini : { *(.rela.fini) }
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
.rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
.rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
.rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
.rela.ctors : { *(.rela.ctors) }
.rela.dtors : { *(.rela.dtors) }
.rela.got : { *(.rela.got) }
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
.rela.ldata : { *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) }
.rela.lbss : { *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) }
.rela.lrodata : { *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) }
.rela.ifunc : { *(.rela.ifunc) }
.rela.plt :
{
*(.rela.plt)
PROVIDE_HIDDEN (__rela_iplt_start = .);
*(.rela.iplt)
PROVIDE_HIDDEN (__rela_iplt_end = .);
}
.init :
{
KEEP (*(.init))
} =0x90909090
.plt : { *(.plt) *(.iplt) }
.text :
{
PROVIDE_HIDDEN (__eprol = .);
*(.text.unlikely .text.*_unlikely)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} =0x90909090
.fini :
{
KEEP (*(.fini))
} =0x90909090
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
/* Exception handling */
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
/* Thread Local Storage sections */
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
}
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
}
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array))
PROVIDE_HIDDEN (__fini_array_end = .);
}
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
.dynamic : { *(.dynamic) }
.got : { *(.got) *(.igot) }
. = DATA_SEGMENT_RELRO_END (24, .);
.got.plt : { *(.got.plt) *(.igot.plt) }
.data :
{
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(16);
PROVIDE (_eeprom_start__ = .);
*(.eeprom)
. = ALIGN(16);
PROVIDE (_game_descriptors_start__ = .);
*(.game_descriptors)
PROVIDE (_game_descriptors_end__ = .);
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
_edata = .; PROVIDE (edata = .);
__bss_start = .;
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
FIXME: Why do we need it? When there is no .bss section, we don't
pad the .data section. */
. = ALIGN(. != 0 ? 64 / 8 : 1);
}
.lbss :
{
*(.dynlbss)
*(.lbss .lbss.* .gnu.linkonce.lb.*)
*(LARGE_COMMON)
}
. = ALIGN(64 / 8);
.lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
{
*(.lrodata .lrodata.* .gnu.linkonce.lr.*)
}
.ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
{
*(.ldata .ldata.* .gnu.linkonce.l.*)
. = ALIGN(. != 0 ? 64 / 8 : 1);
}
. = ALIGN(64 / 8);
_end = .; PROVIDE (end = .);
. = DATA_SEGMENT_END (.);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* DWARF 3 */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { *(.debug_ranges) }
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
}

5
profiles/LoL-Shield_Leonardo

@ -21,6 +21,7 @@ BORG_HW=HW_LOLSHIELD
#
USER_TIMER0_FOR_WAIT=1
BRIGHTNESS=127
FRAMERATE=80
#
# Features
@ -88,7 +89,7 @@ GOL_CYCLES=360
ANIMATION_BREAKOUT=y
# ANIMATION_MHERWEG is not set
ANIMATION_MOIRE=y
# ANIMATION_LTN_ANT is not set
ANIMATION_LTN_ANT=y
# ANIMATION_TIME is not set
TIME_MASTER_ADDR=00
TIME_UPDATE_TIMEOUT=50
@ -105,7 +106,7 @@ ANIMATION_PLASMA=y
FP_PLASMA_DELAY=10
ANIMATION_PSYCHEDELIC=y
FP_PSYCHO_DELAY=25
ANIMATION_BLACKHOLE=y
# ANIMATION_BLACKHOLE is not set
ANIMATION_SQUARES=y
# ANIMATION_TESTS is not set
# ANIMATION_OFF is not set

128
profiles/LoL-Shield_Mega1280

@ -0,0 +1,128 @@
#
# Automatically generated by make menuconfig: don't edit
#
#
# General Setup
#
MCU=atmega1280
FREQ=16000000
#
# Borg Hardware
#
NUM_ROWS=9
NUM_COLS=14
NUMPLANE=3
BORG_HW=HW_LOLSHIELD
#
# lolshield setup
#
USER_TIMER0_FOR_WAIT=1
BRIGHTNESS=127
FRAMERATE=80
#
# Features
#
RANDOM_SUPPORT=y
# LAP_TIME_EXTENSION is not set
SCROLLTEXT_SUPPORT=y
SCROLLTEXT_FONT=FONT_C64
SCROLLTEXT_BUFFER_SIZE=128
SCROLL_X_SPEED=20
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#Borgware 2D"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
JOYSTICK_SUPPORT=y
JOYSTICK_CHOICE=JOY_LOLSHIELD
LOLSHIELD_JOYSTICK_SUPPORT=y
# CAN_SUPPORT is not set
MENU_SUPPORT=y
#
# Games
#
GAME_TETRIS_CORE=y
GAME_TETRIS=y
GAME_BASTET=y
# GAME_TETRIS_FP is not set
GAME_SPACE_INVADERS=y
GAME_SNAKE=y
GAME_BREAKOUT=y
#
# Animations
#
ANIMATION_SCROLLTEXT=y
ANIMATION_SPIRAL=y
SPIRAL_DELAY=5
ANIMATION_JOERN1=y
ANIMATION_SNAKE=y
SNAKE_GAME_DELAY=200
SNAKE_ANIM_DELAY=100
SNAKE_TERMINATION_DELAY=60
SNAKE_MAX_LENGTH=64
SNAKE_MAX_APPLES=10
ANIMATION_CHECKERBOARD=y
ANIMATION_FIRE=y
FIRE_S=30
FIRE_N=5
FIRE_DIV=44
FIRE_DELAY=50
FIRE_CYCLES=800
ANIMATION_MATRIX=y
MATRIX_STREAMER_NUM=30
MATRIX_CYCLES=500
MATRIX_DELAY=60
ANIMATION_RANDOM_BRIGHT=y
ANIMATION_STONEFLY=y
ANIMATION_FLYINGDOTS=y
ANIMATION_GAMEOFLIFE=y
GOL_DELAY=100
GOL_CYCLES=360
ANIMATION_BREAKOUT=y
# ANIMATION_MHERWEG is not set
ANIMATION_MOIRE=y
ANIMATION_LTN_ANT=y
# ANIMATION_TIME is not set
TIME_MASTER_ADDR=00
TIME_UPDATE_TIMEOUT=50
ANIMATION_BMSCROLLER=y
# ANIMATION_LABORLOGO is not set
ANIMATION_AMPHIBIAN=y
# ANIMATION_LOGO_OOS is not set
ANIMATION_FAIRYDUST=y
#
# Fixed-point math patterns
#
ANIMATION_PLASMA=y
FP_PLASMA_DELAY=10
ANIMATION_PSYCHEDELIC=y
FP_PSYCHO_DELAY=25
ANIMATION_BLACKHOLE=y
ANIMATION_SQUARES=y
ANIMATION_TESTS=y
ANIMATION_OFF=y
#
# small Animations
#
# SMALLANIMATION_ROWWALK is not set
SMALLANIMATION_ROWWALK_SPEED=50
SMALLANIMATION_ROWWALK_COUNT=10
# SMALLANIMATION_COLWALK is not set
SMALLANIMATION_COLWALK_SPEED=50
SMALLANIMATION_COLWALK_COUNT=10
# SMALLANIMATION_ROWBOUNCE is not set
SMALLANIMATION_ROWBOUNCE_SPEED=50
SMALLANIMATION_ROWBOUNCE_COUNT=10
# SMALLANIMATION_COLBOUNCE is not set
SMALLANIMATION_COLBOUNCE_SPEED=50
SMALLANIMATION_COLBOUNCE_COUNT=10

1
profiles/LoL-Shield_Mega2560

@ -21,6 +21,7 @@ BORG_HW=HW_LOLSHIELD
#
USER_TIMER0_FOR_WAIT=1
BRIGHTNESS=127
FRAMERATE=80
#
# Features

1
profiles/LoL-Shield_Uno-Duemilanove-Diavolino

@ -21,6 +21,7 @@ BORG_HW=HW_LOLSHIELD
#
USER_TIMER0_FOR_WAIT=1
BRIGHTNESS=127
FRAMERATE=80
#
# Features

8
scripts/lxdialog/Makefile

@ -4,6 +4,9 @@ LIBS = -lncurses
ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
else
ifeq (/usr/pkg/include/ncurses/ncurses.h, $(wildcard /usr/pkg/include/ncurses/ncurses.h))
HOSTCFLAGS += -I/usr/pkg/include -I/usr/pkg/include/ncurses -DCURSES_LOC="<ncurses.h>" -L/usr/pkg/lib -Wl,-R/usr/pkg/lib
else
ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
else
@ -14,6 +17,7 @@ else
endif
endif
endif
endif
OBJS = checklist.o menubox.o textbox.o yesno.o inputbox.o \
@ -25,11 +29,11 @@ OBJS = checklist.o menubox.o textbox.o yesno.o inputbox.o \
all: ncurses lxdialog
lxdialog: $(OBJS)
$(HOSTCC) -o lxdialog $(OBJS) $(LIBS)
$(HOSTCC) $(HOSTCFLAGS) -o lxdialog $(OBJS) $(LIBS)
ncurses:
@echo "main() {}" > lxtemp.c
@if $(HOSTCC) -lncurses lxtemp.c ; then \
@if $(HOSTCC) $(HOSTCFLAGS) -lncurses lxtemp.c ; then \
rm -f lxtemp.c a.out; \
else \
rm -f lxtemp.c; \

149
src/borg_hw/borg_hw_lolshield.c

@ -1,15 +1,20 @@
/**
* @file borg_hw_lolshield.c
* @brief Driver for Jimmie Rodgers' LoL Shield
* @author Christian Kroll
* @author Jimmie Rodgers
* @author Christian Kroll <chris@das-labor.org>
* @date 2014
* @copyright GNU Public License 2 or later
* @see http://jimmieprodgers.com/kits/lolshield/
*
* This driver is partly based on Jimmie Rodger's LoL Shield Library which
* is available at https://code.google.com/p/lolshield/ (parts of the file
* "Charliplexing.cpp" have been incorporated into this file).
* This driver is partly based on the LoL Shield Library which is available at
* https://code.google.com/p/lolshield/ (parts of the file "Charliplexing.cpp"
* have been incorporated into this file).
*
* With contributions from (via "Charliplexing.cpp"):
* Alex Wenger <a.wenger@gmx.de> http://arduinobuch.wordpress.com/
* Matt Mets <mahto@cibomahto.com> http://cibomahto.com/
* Timer init code from MsTimer2 - Javier Valencia <javiervalencia80@gmail.com>
* Misc functions from Benjamin Sonntag <benjamin@sonntag.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -42,11 +47,19 @@
// buffer which holds the currently shown frame
unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
/* adjust frame rate at the menuconfig, this is just a fallback */
#ifndef FRAMERATE
# define FRAMERATE 80
#elif FRAMERATE < 1
# error FRAMERATE must be greater than 0
#endif
// Number of ticks of the prescaled timer per cycle per frame, based on the
// CPU clock speed and the desired frame rate.
#define FRAMERATE 80UL
#define TICKS (F_CPU + 6 * (FRAMERATE << SLOWSCALERSHIFT)) / (12 * (FRAMERATE << SLOWSCALERSHIFT))
#define CUTOFF(scaler) ((128 * 12 - 6) * FRAMERATE * scaler)
#define TICKS (F_CPU + 6ul * (FRAMERATE << SLOWSCALERSHIFT)) / \
(12ul * (FRAMERATE << SLOWSCALERSHIFT))
#define CUTOFF(scaler) ((128ul * 12 - 6) * FRAMERATE * scaler##ul)
#if defined (__AVR_ATmega8__) || \
defined (__AVR_ATmega48__) || \
@ -120,17 +133,6 @@ unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
# error no support for this chip
#endif
#ifndef BRIGHTNESS
# define BRIGHTNESS 127 /* full brightness by default */
#elif BRIGHTNESS < 0 || BRIGHTNESS > 127
# error BRIGHTNESS must be between 0 and 127
#endif
#define BRIGHTNESSPERCENT ((BRIGHTNESS * BRIGHTNESS + 8ul) / 16ul)
#define M (TICKS << FASTSCALERSHIFT) * BRIGHTNESSPERCENT /*10b*/
#define C(x) ((M * (unsigned long)(x * 1024) + (1 << 19)) >> 20) /*10b+10b-20b=0b*/
#if NUMPLANE < 8
uint8_t const prescaler[NUMPLANE + 1] = {
FASTPRESCALER,
@ -158,81 +160,100 @@ uint8_t const prescaler[NUMPLANE + 1] = {
uint8_t prescaler[NUMPLANE + 1] = {0};
#endif
uint8_t counts[NUMPLANE + 1] = {0};
/* adjust brightness in the menuconfig, this is just a fallback */
#ifndef BRIGHTNESS
# define BRIGHTNESS 127 /* full brightness by default */
#elif BRIGHTNESS < 0 || BRIGHTNESS > 127
# error BRIGHTNESS must be between 0 and 127
#endif
/**
* Set the overall brightness of the screen from 0 (off) to 127 (full on).
*/
static void setBrightness()
{
/* ---- This needs review! Please review. -- thilo */
// set up page counts
uint8_t i;
#define BRIGHTNESSPERCENT ((BRIGHTNESS * BRIGHTNESS + 8ul) / 16ul)
#define M (TICKS << FASTSCALERSHIFT) * BRIGHTNESSPERCENT /*10b*/
#define C(x) ((M * (unsigned long)(x * 1024UL) + (1UL << 19)) >> 20) /*10b+10b-20b=0b*/
#define COUNT(u, v) (256 - (((C(v) - C(u)) != 0) ? (C(v) - C(u)) : 1))
#define LAST_COUNT(u) (256 - (((TICKS - (C(u) >> FASTSCALERSHIFT)) != 0) ? \
(TICKS - (C(u) >> FASTSCALERSHIFT)) : 1))
// NOTE: The argument of C() is calculated as follows:
#if NUMPLANE < 8
// NOTE: The argumentS of COUNT() are calculated as follows:
// pow((double)x / (double)NUMPLANE, 1.8) with 0 <= x <= NUMPLANE
// Changing the scale of 1.8 invalidates any tables above!
#if NUMPLANE < 8
int const temp_counts[NUMPLANE + 1] = {
0.000000000000000000000000000,
# if NUMPLANE == 2
C(0.287174588749258719033719),
uint8_t const counts[NUMPLANE + 1] = {
# if NUMPLANE == 1
COUNT(0.000000000000000000000000, 1.000000000000000000000000),
# elif NUMPLANE == 2
COUNT(0.000000000000000000000000, 0.287174588749258719033719),
COUNT(0.287174588749258719033719, 1.000000000000000000000000),
# elif NUMPLANE == 3
C(0.138414548846168578011273),
C(0.481987453865643789008288),
COUNT(0.000000000000000000000000, 0.138414548846168578011273),
COUNT(0.138414548846168578011273, 0.481987453865643789008288),
COUNT(0.481987453865643789008288, 1.000000000000000000000000),
# elif NUMPLANE == 4
C(0.082469244423305887448095),
C(0.287174588749258719033719),
C(0.595813410589956848895099),
COUNT(0.000000000000000000000000, 0.082469244423305887448095),
COUNT(0.082469244423305887448095, 0.287174588749258719033719),
COUNT(0.287174588749258719033719, 0.595813410589956848895099),
COUNT(0.595813410589956848895099, 1.000000000000000000000000),
# elif NUMPLANE == 5
C(0.055189186458448592775827),
C(0.192179909437029006191722),
C(0.398723883569384374148115),
C(0.669209313658414961523135),
COUNT(0.000000000000000000000000, 0.055189186458448592775827),
COUNT(0.055189186458448592775827, 0.192179909437029006191722),
COUNT(0.192179909437029006191722, 0.398723883569384374148115),
COUNT(0.398723883569384374148115, 0.669209313658414961523135),
COUNT(0.669209313658414961523135, 1.000000000000000000000000),
# elif NUMPLANE == 6
C(0.039749141141812646682574),
C(0.138414548846168578011273),
C(0.287174588749258719033719),
C(0.481987453865643789008288),
C(0.720234228706005730202833),
COUNT(0.000000000000000000000000, 0.039749141141812646682574),
COUNT(0.039749141141812646682574, 0.138414548846168578011273),
COUNT(0.138414548846168578011273, 0.287174588749258719033719),
COUNT(0.287174588749258719033719, 0.481987453865643789008288),
COUNT(0.481987453865643789008288, 0.720234228706005730202833),
COUNT(0.720234228706005730202833, 1.000000000000000000000000),
# elif NUMPLANE == 7
C(0.030117819624378608378557),
C(0.104876339357015443964904),
C(0.217591430058779483625031),
C(0.365200625214741059210155),
C(0.545719579451565794947498),
C(0.757697368024318751444923),
COUNT(0.000000000000000000000000, 0.030117819624378608378557),
COUNT(0.030117819624378608378557, 0.104876339357015443964904),
COUNT(0.104876339357015443964904, 0.217591430058779483625031),
COUNT(0.217591430058779483625031, 0.365200625214741059210155),
COUNT(0.365200625214741059210155, 0.545719579451565794947498),
COUNT(0.545719579451565794947498, 0.757697368024318751444923),
COUNT(0.757697368024318751444923, 1.000000000000000000000000),
# endif
C(1.000000000000000000000000),
LAST_COUNT(1.0)
};
#else
uint8_t counts[NUMPLANE + 1];
#endif
#if NUMPLANE >= 8
/**
* Set the overall brightness of the screen from 0 (very dim) to 127 (full on).
*/
static void setBrightness()
{
# warning "NUMPLANE >= 8 links floating point stuff into the image"
/* ---- This needs review! Please review. -- thilo */
// set up page counts
uint8_t i;
// NOTE: Changing "scale" invalidates any tables above!
const float scale = 1.8f;
int temp_counts[NUMPLANE + 1] = {0};
for (i = 1; i < (NUMPLANE + 1); i++) {
temp_counts[i] = C(pow(i / (float)(NUMPLANE), scale));
}
#endif
// Compute on time for each of the pages
// Use the fast timer; slow timer is only useful for < 3 shades.
for (i = 0; i < NUMPLANE; i++) {
int interval = temp_counts[i + 1] - temp_counts[i];
counts[i] = 256 - (interval ? interval : 1);
#if NUMPLANE >= 8
prescaler[i] = FASTPRESCALER;
#endif
}
// Compute off time
int interval = TICKS - (temp_counts[i] >> FASTSCALERSHIFT);
counts[i] = 256 - (interval ? interval : 1);
#if NUMPLANE >= 8
prescaler[i] = SLOWPRESCALER;
#endif
}
#endif
/**
* Distributes the framebuffer content among current cycle pins.
@ -244,10 +265,6 @@ static void compose_cycle(uint8_t const cycle, uint8_t plane) {
uint8_t *const p = &pixmap[plane][0][0];
#if defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__)
# ifdef __AVR_ATmega1280__
# warning "BEWARE: Borgware-2D has not been tested on Arduino Mega 1280!"
# endif
// Set sink pin to Vcc/source, turning off current.
static uint8_t sink_b = 0, sink_e = 0, sink_g = 0, sink_h = 0;
PINB = sink_b;
@ -925,7 +942,9 @@ void borg_hw_init() {
OCR1A = 256;
#endif
#if NUMPLANE >= 8
setBrightness();
#endif
// Then start the display
#if defined (__AVR_ATmega48__) || \

1
src/borg_hw/config_lolshield.in

@ -4,5 +4,6 @@ comment "lolshield setup"
define_int USER_TIMER0_FOR_WAIT 1
uint "Brightness (0-127)" BRIGHTNESS 127
uint "Framerate (default 80)" FRAMERATE 80
endmenu

1
src/games/snake/snake_game.c

@ -19,6 +19,7 @@
#include "../../util.h"
#include "../../joystick/joystick.h"
#include "../../menu/menu.h"
#include "../../scrolltext/scrolltext.h"
#include "snake_game.h"

4
src/rfm12/rfm12_config.h

@ -51,6 +51,9 @@
#include <avr/interrupt.h>
// don't ask...someone wanted to invent something more fancy than __AVR__ *sigh*
#define __PLATFORM_AVR__
//Pin that the RFM12's slave select is connected to
//#define DDR_SS DDRB
//#define PORT_SS PORTB
@ -171,4 +174,3 @@
* en- or disable debugging via uart.
*/
#define RFM12_UART_DEBUG 0

2
src/rfm12/rfm12_lib

@ -1 +1 @@
Subproject commit e49ecece7baf2faa48ed2f6c659228b4d77c0c66
Subproject commit 8e5d7e54e2c20f5c3d5a4306e5c186059866a2a8
Loading…
Cancel
Save