Skip to content

Commit

Permalink
LUDA, bootloader, makefile update
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossless committed Apr 28, 2017
1 parent d2024e3 commit f8e2219
Show file tree
Hide file tree
Showing 464 changed files with 86,270 additions and 3 deletions.
9 changes: 9 additions & 0 deletions LUFA/Build/DMBS/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.lss
*.bin
*.elf
*.hex
*.eep
*.map
*.o
*.d
*.sym
39 changes: 39 additions & 0 deletions LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/HID_EEPROM_Loader.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
DMBS Build System
Released into the public domain.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/

/** \file
*
* Special application to extract an EEPROM image stored in FLASH memory, and
* copy it to the device EEPROM. This application is designed to be used with
* the HID build system module of DMBS to program the EEPROM of a target device
* that uses the HID bootloader protocol, which does not have native EEPROM
* programming support.
*/

#include <avr/io.h>
#include <avr/eeprom.h>
#include <avr/pgmspace.h>

/* References to the binary EEPROM data linked in the AVR's FLASH memory space */
extern const char _binary_InputEEData_bin_start[];
extern const char _binary_InputEEData_bin_end[];
extern const char _binary_InputEEData_bin_size[];

/* Friendly names for the embedded binary data stored in FLASH memory space */
#define InputEEData _binary_InputEEData_bin_start
#define InputEEData_size ((int)_binary_InputEEData_bin_size)

int main(void)
{
/* Copy out the embedded EEPROM data from FLASH to EEPROM memory space */
for (uint16_t i = 0; i < InputEEData_size; i++)
eeprom_update_byte((uint8_t*)i, pgm_read_byte(&InputEEData[i]));

/* Infinite loop once complete */
for (;;);
}
35 changes: 35 additions & 0 deletions LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#
# DMBS Build System
# Released into the public domain.
#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#

# Run "make help" for target help.

MCU = atmega128
ARCH = AVR8
F_CPU = 1000000
OPTIMIZATION = s
TARGET = HID_EEPROM_Loader
SRC = $(TARGET).c
CC_FLAGS =
LD_FLAGS =
OBJECT_FILES = InputEEData.o

# Default target
all:

# Determine the AVR sub-architecture of the build main application object file
FIND_AVR_SUBARCH = avr$(shell avr-objdump -f $(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1)

# Create a linkable object file with the input binary EEPROM data stored in the FLASH section
InputEEData.o: InputEEData.bin $(TARGET).o $(MAKEFILE_LIST)
@echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a object file \"$@\"
avr-objcopy -I binary -O elf32-avr -B $(call FIND_AVR_SUBARCH) --rename-section .data=.progmem.data,contents,alloc,readonly,data $< $@

# Include LUFA build script makefiles
include ../core.mk
include ../gcc.mk
include ../hid.mk
32 changes: 32 additions & 0 deletions LUFA/Build/DMBS/DMBS/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
DMBS Build System
Released into the public domain.

dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com



This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>
38 changes: 38 additions & 0 deletions LUFA/Build/DMBS/DMBS/ModulesOverview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
DMBS - Dean's Makefile Build System
===================================


Modules Overview
----------------

The following modules are currently included:

- [ATPROGRAM](atprogram.md) - Device Programming
- [AVRDUDE](avrdude.md) - Device Programming
- [CORE](core.md) - DMBS Core Functionality
- [CPPCHECK](cppcheck.md) - Static Code Analysis
- [DFU](dfu.md) - Device Programming
- [DOXYGEN](doxygen.md) - Automated Source Code Documentation
- [GCC](gcc.md) - Compiling/Assembling/Linking with GCC
- [HID](hid.md) - Device Programming

## Importing modules into your project makefile

To use a module, it is recommended to add the following boilerplate to your
makefile:

# Include DMBS build script makefiles
DMBS_PATH ?= ../DMBS

Which can then used to indicate the location of your DMBS installation, relative
to the current directory, when importing modules. For example:

DMBS_PATH ?= ../DMBS
include $(DMBS_PATH)/core.mk
include $(DMBS_PATH)/gcc.mk

Imports the `CORE` and `GCC` modules from DMBS using a single path relative to
your project's makefile.

If you wish to write your own DMBS module(s),
[see the documentation here for more details.](WritingYourOwnModules.md)
94 changes: 94 additions & 0 deletions LUFA/Build/DMBS/DMBS/WritingYourOwnModules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
DMBS - Dean's Makefile Build System
===================================


Writing Your Own Modules
------------------------

A DMBS module consists of the several boilerplate sections, explained below.

## The DMBS module hooks

Your module needs to advertise to DMBS its name, its makefile targets, the
required and optional variables, and the variables and macros the module
provides for use elsewhere. This is achieved with the following section:

DMBS_BUILD_MODULES += EXAMPLE
DMBS_BUILD_TARGETS += example-target another-target
DMBS_BUILD_MANDATORY_VARS += MANDATORY_NAME ALSO_MANDATORY
DMBS_BUILD_OPTIONAL_VARS += OPTIONAL_NAME ALSO_OPTIONAL
DMBS_BUILD_PROVIDED_VARS += MEANING_OF_LIFE
DMBS_BUILD_PROVIDED_MACROS += STRIP_WHITESPACE

The example above declares that this module is called `EXAMPLE`, and exposes the
listed targets, variable requirements and provides variables and macros.

Your module name and provided variable/macro names must be unique, however you
can (and should) re-use variable names where appropriate if they apply to
several modules (such as `ARCH` to specify the project's microcontroller
architecture). Re-using targets is not recommended, but can be used to extend
the dependencies of another module's targets.

## Importing the CORE module

Next, your module should always import the DMBS `CORE` module, via the
following:

# Conditionally import the CORE module of DMBS if it is not already imported
DMBS_MODULE_PATH := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
ifeq ($(findstring CORE, $(DMBS_BUILD_MODULES)),)
include $(DMBS_MODULE_PATH)/core.mk
endif

This ensures that the `make help` target is always available. In addition, the
`CORE` module exposes some [commonly used macros and variables](core.md) to
your module.

## Setting optional variable's defaults

If a variable is optional, you should provide a default value. Do this via the
`?=` operator of `make`, which sets a variable's value if it has not yet been
set:

MY_OPTIONAL_VARIABLE ?= some_default_value

## Sanity checking user input

Sanity checks are what make DMBS useful. Where possible, validate user input and
convert generated errors to human-friendly messages. This can be achieved by
enforcing that all the declared module mandatory variables have been set by the
user:

# Sanity-check values of mandatory user-supplied variables
$(foreach MANDATORY_VAR, $(DMBS_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))

As well as complaining if they are set, but currently empty:
$(call ERROR_IF_EMPTY, SOME_MANDATORY_VARIABLE)
$(call ERROR_IF_EMPTY, SOME_OPTIONAL_BUT_NON_EMPTY_VARIABLE)

Or even if they are boolean (`Y` or `N`) variables that have an invalid value:

$(call ERROR_IF_NONBOOL, SOME_BOOL_VARIABLE)

## Adding targets

The meat of a DMBS module is the targets, which are run when the user types
`make {target name}` from the command line. These can be as complex or simple
as you like. See the GNU make manual for information on writing make targets.

example-target:
echo "Your DMBS module works!"

## And finally, list the PHONYs

Important in GNU Make is the concept of phony targets; this special directive
tells make that a given target should never be considered a valid file. Listing
phonies ensures that, for example, if your module had a target called `build`,
it would always run when the user types `make build` from the command line, even
if a file called `build` existed in the user project folder.

You can list module-internal targets here, as well as mark all public targets
via the module header's `DMBS_BUILD_TARGETS` variable.

# Phony build targets for this module
.PHONY: $(DMBS_BUILD_TARGETS) some-module-internal-target another-internal-target
119 changes: 119 additions & 0 deletions LUFA/Build/DMBS/DMBS/atprogram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
DMBS - Dean's Makefile Build System
===================================


Module: ATPROGRAM
-----------------

The ATPROGRAM module provides build targets for use with the official
`ATPROGRAM` back-end utility distributed with the free
[Atmel Studio](http://www.atmel.com) software released by Atmel.

## Importing This Module into a Makefile:

To use this module in your application makefile, add the following code to your
makefile:

include $(DMBS_PATH)/atprogram.mk

## Prerequisites:

This module requires the `atprogram.exe` utility to be available in your
system's `PATH` variable. The `atprogram.exe` utility is distributed in Atmel
Studio (usually) inside the application install folder's `atbackend`
subdirectory.

## Build Targets:

The following targets are supported by this module:

<table>
<tbody>
<tr>
<td>atprogram</td>
<td>Program the device FLASH memory with the application's executable data.</td>
</tr>
<tr>
<td>atprogram-ee</td>
<td>Program the device EEPROM memory with the application's EEPROM data.</td>
</tr>
</tbody>
</table>

## Mandatory Variables:

The following variables must be defined (with a `NAME = VALUE` syntax, one
variable per line) in the user makefile to be able to use this module:

<table>
<tbody>
<tr>
<td>MCU</td>
<td>Name of the Atmel processor model (e.g. `at90usb1287`).</td>
</tr>
<tr>
<td>TARGET</td>
<td>Name of the application output file prefix (e.g. `TestApplication`).</td>
</tr>
</tbody>
</table>

## Optional Variables:

The following variables may be defined (with a `NAME = VALUE` syntax, one
variable per line) in the user makefile. If not specified, a default value will
be assumed.

<table>
<tbody>
<tr>
<td>ATPROGRAM_PROGRAMMER</td>
<td>Name of the Atmel programmer or debugger tool to communicate with (e.g. `jtagice3`). Default is `atmelice`.</td>
</tr>
<tr>
<td>ATPROGRAM_INTERFACE</td>
<td>Name of the programming interface to use when programming the target (e.g. `spi`). Default is `jtag`.</td>
</tr>
<tr>
<td>ATPROGRAM_PORT</td>
<td>Name of the communication port to use when when programming with a serially connected tool (e.g. `COM2`). Default is `usb`.</td>
</tr>
</tbody>
</table>

## Provided Variables:

The following variables may be referenced in a user makefile (via `$(NAME)`
syntax) if desired, as they are provided by this module.

<table>
<tbody>
<tr>
<td>N/A</td>
<td>This module provides no variables.</td>
</tr>
</tbody>
</table>

## Provided Macros:

The following macros may be referenced in a user makefile (via
`$(call NAME, ARG1, ARG2, ...)` syntax) if desired, as they are provided by
this module.

<table>
<tbody>
<tr>
<td>N/A</td>
<td>This module provides no macros.</td>
</tr>
</tbody>
</table>

## Module Changelog:

The changes to this module since its initial release are listed below, as of the
DMBS version where the change was made.

### 20160403
Initial release.
Loading

0 comments on commit f8e2219

Please sign in to comment.