Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b57ceb6
pre-mega-merge: abstract some cmake files from greatfet
ktemkin Feb 22, 2019
9e0361c
pre-mega-merge: cmake cleanup to ready for future changes
ktemkin Feb 25, 2019
b65c7f0
build: implement module system to make building cleaner/easier
ktemkin Feb 26, 2019
2ceb693
libgreat: temporarily have all modules depend on libopencm3 :(
ktemkin Feb 26, 2019
ae7fb10
cmake: allow compatibility with CMake 3.2+
ktemkin Mar 2, 2019
7af7c9c
cmake: add more compatibility shims for older cmake versions
ktemkin Mar 2, 2019
9a494e1
firmware: merge in libgreat working state ('mega-merge')
ktemkin Mar 5, 2019
3f35e54
firmware: add start of AD970x driver (supporting Gladiolus)
ktemkin Mar 6, 2019
3353728
pygreat: handle versioning correctly, in preparation for GreatFET rel…
ktemkin Mar 8, 2019
5b81c39
lpc43xx: clock driver: fix a clock source selection issue
ktemkin Mar 11, 2019
34fde42
firmware: add support for simple "scheduling"
ktemkin Mar 25, 2019
4529b04
lpc43xx clock: change the way we detect USB PLL, and improve stability
ktemkin Mar 27, 2019
7456a69
firmware: cmake: provide the capability to rely on per-module extra i…
ktemkin Apr 4, 2019
eb9809c
firmware: cmake: provide functionality to facilitate build configuration
ktemkin Apr 5, 2019
aecadb2
firmware: add support for advanced debug logging / backtracing
ktemkin Apr 5, 2019
d581746
firmware: toolchain: add USED attribute
ktemkin Apr 5, 2019
22ee0ac
firmware: cmake: improve dependent-feature hiding logic
ktemkin Apr 5, 2019
897e30d
firmware: linker: don't include a redundnant and incorrect extab loca…
ktemkin Apr 5, 2019
e00a9a8
firmware: cmake: silence an errant status message
ktemkin Apr 5, 2019
14c00b7
release-prep: improve autoversioning scheme
ktemkin Apr 24, 2019
424fa14
host: fix our versioning scheme
ktemkin May 4, 2019
dfcd6a4
pygreat: restore python2 compatibility
ktemkin May 4, 2019
1578468
windows-compat: allow cases where libusb reports no error code
ktemkin May 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Compiled output
*.bin
*.d
*.elf
*.hex
*.srec
*.dfu
host/build/

# CMakeInternals
CMakeFiles
CMakeCache.txt

# Compiled python files
__pycache__/
*.py[cod]
*$py.class
host/dist
*.egg-info

# Operating system spew
.DS_Store
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Editor junk
*.swp
*.sublime-project
*.sublime-workspace
.vscode
.ccls-cache
compile_commands.json


# ctags output
tags

firmware/*/build

# release files
VERSION
.eggs
50 changes: 0 additions & 50 deletions CMakeLists.txt

This file was deleted.

50 changes: 50 additions & 0 deletions firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
# This file is part of GreatFET
#
cmake_minimum_required(VERSION 3.1.3)

include(cmake/libgreat_prelude.cmake)
project(libgreat C CXX ASM)
include(cmake/libgreat.cmake)

# Include any platform-specific targets desired.
add_subdirectory(${PATH_LIBGREAT_FIRMWARE_PLATFORM})

# Include the core libgreat library.
add_libgreat_library_if_necessary(libgreat OBJECT

# Archictecture support.
# TODO: move me to an architecture support package?
${PATH_LIBGREAT_FIRMWARE_PLATFORM}/sync.c
${PATH_LIBGREAT_FIRMWARE_PLATFORM}/sync.S

${PATH_LIBGREAT_FIRMWARE_PLATFORM_DRIVERS}/arm_system_control.c
)
use_libgreat_modules(libgreat bsp) # Always include the board support package for the current board.

# Provide a basic allocator.
define_libgreat_module(allocator
${PATH_LIBGREAT_FIRMWARE_DRIVERS}/memory/allocator.c
${PATH_LIBGREAT_FIRMWARE_DRIVERS}/memory/allocator/umm_malloc.c
)

# Provide the core communications protocol.
define_libgreat_module(comms
${PATH_LIBGREAT_FIRMWARE_DRIVERS}/comms/utils.c
${PATH_LIBGREAT_FIRMWARE_DRIVERS}/comms/comms_class.c
${PATH_LIBGREAT_FIRMWARE}/classes/core.c
${PATH_LIBGREAT_FIRMWARE}/classes/firmware.c
)

# DAC drivers.
define_libgreat_module(ad970x
${PATH_LIBGREAT_FIRMWARE_DRIVERS}/dac/ad970x.c
)

# Scheduler.
define_libgreat_module(scheduler
${PATH_LIBGREAT_FIRMWARE_DRIVERS}/scheduler.c
)

# FIXME: get rid of this
add_dependencies(libgreat libopencm3)
28 changes: 14 additions & 14 deletions firmware/classes/core.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of libgreat
*
* Core communications class -- provides
* Core communications class -- provides
*/

#include <stddef.h>
Expand All @@ -17,28 +17,28 @@

extern struct comms_class *class_head;

WEAK int core_verb_read_board_id(struct command_transaction *trans)
ATTR_WEAK int core_verb_read_board_id(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
}


WEAK int core_verb_read_version_string(struct command_transaction *trans)
ATTR_WEAK int core_verb_read_version_string(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
}


WEAK int core_verb_read_part_id(struct command_transaction *trans)
ATTR_WEAK int core_verb_read_part_id(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
}


WEAK int core_verb_read_serial_number(struct command_transaction *trans)
ATTR_WEAK int core_verb_read_serial_number(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
Expand All @@ -47,7 +47,7 @@ WEAK int core_verb_read_serial_number(struct command_transaction *trans)
/**
* TODO: get me out of here!
*/
WEAK int core_verb_request_reset(struct command_transaction *trans)
ATTR_WEAK int core_verb_request_reset(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
Expand All @@ -56,14 +56,14 @@ WEAK int core_verb_request_reset(struct command_transaction *trans)

/**
* Internal introspection command that returns the list of supported classes.
*/
*/
static int verb_get_available_classes(struct command_transaction *trans)
{
struct comms_class *cls;

// Add each class number to the list.
for (cls = class_head; cls; cls = cls->next) {
comms_response_add_uint32_t(trans, cls->class_number);
comms_response_add_uint32_t(trans, cls->class_number);
}

return 0;
Expand All @@ -72,7 +72,7 @@ static int verb_get_available_classes(struct command_transaction *trans)

/**
* Internal introspection command that returns the list of supported classes.
*/
*/
static int verb_get_verb_name(struct command_transaction *trans)
{
uint32_t class_number = comms_argument_parse_uint32_t(trans);
Expand Down Expand Up @@ -110,7 +110,7 @@ enum verb_descriptor_request {

/**
* Internal introspection command that returns information about a verb.
*/
*/
static int verb_get_verb_descriptor(struct command_transaction *trans)
{
uint32_t class_number = comms_argument_parse_uint32_t(trans);
Expand Down Expand Up @@ -155,7 +155,7 @@ static int verb_get_verb_descriptor(struct command_transaction *trans)

/**
* Internal introspection command that returns the list of verbs for a given class.
*/
*/
static int verb_get_available_verbs(struct command_transaction *trans)
{
uint32_t class_number = comms_argument_parse_uint32_t(trans);
Expand All @@ -171,7 +171,7 @@ static int verb_get_available_verbs(struct command_transaction *trans)

// Iterate through the array of command verbs, adding them to our response.
for (verb = relevant_class->command_verbs; verb->handler; ++verb) {
comms_response_add_uint32_t(trans, verb->verb_number);
comms_response_add_uint32_t(trans, verb->verb_number);
}

return 0;
Expand All @@ -181,7 +181,7 @@ static int verb_get_available_verbs(struct command_transaction *trans)

/**
* Internal introspection command that returns the name for a given class.
*/
*/
static int verb_get_class_name(struct command_transaction *trans)
{
uint32_t class_number = comms_argument_parse_uint32_t(trans);
Expand All @@ -203,7 +203,7 @@ static int verb_get_class_name(struct command_transaction *trans)

/**
* Internal introspection command that returns the documentation for a given class.
*/
*/
static int verb_get_class_docs(struct command_transaction *trans)
{
uint32_t class_number = comms_argument_parse_uint32_t(trans);
Expand Down
10 changes: 5 additions & 5 deletions firmware/classes/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* - a uint32_t that indicates the device's page size in bytes.
* - a uint32_t that indicates the device's total size, in bytes
*/
WEAK int firmware_verb_initialize(struct command_transaction *trans)
ATTR_WEAK int firmware_verb_initialize(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
Expand All @@ -40,7 +40,7 @@ WEAK int firmware_verb_initialize(struct command_transaction *trans)
*
* Accepts no arguments.
*/
WEAK int firmware_verb_full_erase(struct command_transaction *trans)
ATTR_WEAK int firmware_verb_full_erase(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
Expand All @@ -51,7 +51,7 @@ WEAK int firmware_verb_full_erase(struct command_transaction *trans)
*
* Accepts a uint32_t that indicates the address.
*/
WEAK int firmware_verb_erase_page(struct command_transaction *trans)
ATTR_WEAK int firmware_verb_erase_page(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
Expand All @@ -63,7 +63,7 @@ WEAK int firmware_verb_erase_page(struct command_transaction *trans)
*
* Accepts a uint32_t that is the address; followed by a single page of data.
*/
WEAK int firmware_verb_write_page(struct command_transaction *trans)
ATTR_WEAK int firmware_verb_write_page(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
Expand All @@ -76,7 +76,7 @@ WEAK int firmware_verb_write_page(struct command_transaction *trans)
* Accepts a uint32_t that is the address.
* Returns the relevant page.
*/
WEAK int firmware_verb_read_page(struct command_transaction *trans)
ATTR_WEAK int firmware_verb_read_page(struct command_transaction *trans)
{
(void)trans;
return ENOSYS;
Expand Down
58 changes: 58 additions & 0 deletions firmware/cmake/compatibility.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# This file is part of libgreat.
# Compatibilty stub that enables us to work down to CMake 3.0.
#

# Compatibility with older CMake versions:

# Target link options are called using target_link_libraries in older versions of cmake.
if (NOT COMMAND target_link_options)
function(target_link_options)
target_link_libraries(${ARGN})
endfunction(target_link_options)
endif()

# We can't use target_link_directories in older cmake; so we'll manually generate the flags for these directories.
if (NOT COMMAND target_link_directories)
function(target_link_directories TARGET SCOPE)

# Add each directory to the search path.
foreach (DIRECTORY ${ARGN})
target_link_options(${TARGET} ${SCOPE} "-L${DIRECTORY}")
endforeach(DIRECTORY)

endfunction(target_link_directories)
endif()

# include_guard() is too new; so we'll emulate it for older verseions of cmake.
if (NOT COMMAND include_guard)
macro(include_guard)

# Detemrine which scope we should use.
if(${ARGN})
if(${ARGN} STREQUAL "GLOBAL")
set(SCOPE "GLOBAL")
else()
set(SCOPE "DIRECTORY")
endif()
else()
set(SCOPE "VARIABLE")
endif()

# Check to see if a relevant variable has ever been included in this scope.
set(__filename "${CMAKE_CURRENT_LIST_FILE}")
get_property(already_included ${SCOPE} PROPERTY "pr_${__filename}")

# If we have been included, abort.
if(already_included)
return()
endif()

# Set a properly-scoped variable that will indicate that this has already been included.
if("${SCOPE}" STREQUAL "VARIABLE")
set("pr_${__filename}" TRUE)
else()
set_property("${SCOPE}" PROPERTY "pr_${__filename}")
endif()
endmacro(include_guard)
endif()
Loading