Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/electron/system module reorder #1065

Merged
merged 2 commits into from Jul 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions modules/electron/system-part1/build.mk
@@ -1,2 +1 @@
SYSTEM_PART1_MODULE_DEPENDENCY=0,0,0
include $(SHARED_MODULAR)/part1_build.mk
include $(SHARED_MODULAR)/part3_build.mk
6 changes: 4 additions & 2 deletions modules/electron/system-part1/import.mk
@@ -1,7 +1,9 @@
include ../../shared/system_module_version.mk
SYSTEM_PART1_MODULE_PATH ?= $(PROJECT_ROOT)/modules/electron/system-part1
include $(call rwildcard,$(SYSTEM_PART1_MODULE_PATH)/,include.mk)
SYSTEM_PART3_MODULE_PATH ?= $(PROJECT_ROOT)/modules/electron/system-part1
include $(call rwildcard,$(SYSTEM_PART3_MODULE_PATH)/,include.mk)
include $(call rwildcard,$(SHARED_MODULAR)/,include.mk)

MODULE_HAS_SYSTEM_PART3=1



13 changes: 8 additions & 5 deletions modules/electron/system-part1/linker.ld
@@ -1,12 +1,15 @@
MEMORY
{
APP_FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 128K

SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 1024
APP_FLASH (rx) : ORIGIN = 0x08060000, LENGTH = 128K
/*
SRAM is located immediately below system-part2, whcih has a base address
of 0x20200000-10K.
*/
SRAM (rwx) : ORIGIN = 0x20020000-6K-10K, LENGTH = 6K
}

INCLUDE module_system_part1_export.ld
INCLUDE module_system_part3_export.ld
INCLUDE module_system_part2_export.ld
INCLUDE module_system_part3_export.ld

INCLUDE ../../shared/stm32f2xx/part1.ld
INCLUDE ../../shared/stm32f2xx/part3.ld
17 changes: 11 additions & 6 deletions modules/electron/system-part1/makefile
Expand Up @@ -3,15 +3,20 @@ WIFI_SYSTEM_MODULE_PATH=.
PROJECT_ROOT=../../..
BUILD_PATH_EXT = $(BUILD_TARGET_PLATFORM)
HAL_LINK :=
PLATFORM_DFU = 0x8020000
PLATFORM_DFU = 0x8060000

# Platform dependency is for the LED implementation used by rgbled.c in services.
MAKE_DEPENDENCIES = communication hal-dynalib services platform
DEPENDENCIES = $(MAKE_DEPENDENCIES) dynalib rt-dynalib modules/electron/system-part2 modules/electron/system-part3
LIB_DEPENDENCIES = services-dynalib rt-dynalib platform
MAKE_DEPENDENCIES = $(LIB_DEPENDENCIES)

DEPENDENCIES = $(MAKE_DEPENDENCIES) dynalib services hal

# rebuild if the linker specs change for other modules
DEPENDENCIES += modules/electron/user-part modules/electron/system-part2 modules/electron/system-part3

include ../modular.mk
include $(PROJECT_ROOT)/build/platform-id.mk
LIBS += $(MAKE_DEPENDENCIES)
LIB_DEPS += $(COMMUNICATION_LIB_DEP) $(HAL_DYNALIB_LIB_DEP) $(SERVICES_LIB_DEP) $(PLATFORM_LIB_DEP)
LIBS += $(LIB_DEPENDENCIES)
LIB_DEPS += $(SERVICES_DYNALIB_LIB_DEP) $(RT_DYNALIB_LIB_DEP) $(PLATFORM_LIB_DEP)
LIB_DIRS += $(dir $(LIB_DEPS))


Expand Down
4 changes: 2 additions & 2 deletions modules/electron/system-part1/src/init_dynalib.c
@@ -1,4 +1,4 @@

#define DYNALIB_EXPORT
#include "module_system_part1_init.h"
#include "module_system_part1_init_dynalib.h"
#include "module_system_part3_init.h"
#include "module_system_part3_init_dynalib.h"
14 changes: 2 additions & 12 deletions modules/electron/system-part2/build.mk
@@ -1,12 +1,2 @@

include ../../shared/stm32f2xx/part2_build.mk

# add dependency and directories for part3
LINKER_DEPS += $(SYSTEM_PART3_MODULE_PATH)/module_system_part3_export.ld
LDFLAGS += -L$(SYSTEM_PART3_MODULE_PATH)


LDFLAGS += -Wl,--defsym,__STACKSIZE__=1400
ASRC += $(COMMON_BUILD)/arm/startup/startup_$(STM32_DEVICE_LC).S
ASFLAGS += -I$(COMMON_BUILD)/arm/startup
ASFLAGS += -Wa,--defsym -Wa,SPARK_INIT_STARTUP=1
SYSTEM_PART1_MODULE_DEPENDENCY=${MODULE_FUNCTION_SYSTEM_PART},3,${SYSTEM_PART3_MODULE_VERSION}
include $(SHARED_MODULAR)/part1_build.mk
8 changes: 6 additions & 2 deletions modules/electron/system-part2/import.mk
@@ -1,3 +1,7 @@
include ../../shared/system_module_version.mk
SYSTEM_PART2_MODULE_PATH ?= $(PROJECT_ROOT)/modules/electron/system-part2
include $(call rwildcard,$(SYSTEM_PART2_MODULE_PATH)/,include.mk)
SYSTEM_PART1_MODULE_PATH ?= $(PROJECT_ROOT)/modules/electron/system-part2
include $(call rwildcard,$(SYSTEM_PART1_MODULE_PATH)/,include.mk)
include $(call rwildcard,$(SHARED_MODULAR)/,include.mk)



26 changes: 3 additions & 23 deletions modules/electron/system-part2/linker.ld
@@ -1,32 +1,12 @@
reset_handler = main;
ENTRY( reset_handler );


MEMORY
{
DCT1_FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 16K
DCT2_FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 16K
APP_FLASH (rx) : ORIGIN = 0x08040000, LENGTH = 128K

/* The SRAM area is offset to include the stack and static ram allocated at the end of the SRAM area.
This is done so that the build outputs meaningful values for BSS and Data section sizes.
APP_FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 128K

The value given here is the sum of system_static_ram_size and stack_size
*/
SRAM (rwx) : ORIGIN = 0x20020000 - 10K, LENGTH = 10K

INCLUDE backup_ram_memory.ld
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 1024
}


/* Define the static locations of the part1 module so the dynamic invoke functions have the base address of each library table. */
INCLUDE module_system_part1_export.ld
INCLUDE module_system_part3_export.ld

/* Definitions for the stack size */
INCLUDE module_system_part2_export.ld

/* Definitions for the static parts of the user module */
INCLUDE module_user_export.ld

INCLUDE ../../shared/stm32f2xx/part2.ld
INCLUDE ../../shared/stm32f2xx/part1.ld
25 changes: 9 additions & 16 deletions modules/electron/system-part2/makefile
@@ -1,28 +1,21 @@
MODULE=system-part2
SYSTEM_PART2_MODULE_PATH=.
PROJECT_ROOT = ../../..
WIFI_SYSTEM_MODULE_PATH=.
PROJECT_ROOT=../../..
BUILD_PATH_EXT = $(BUILD_TARGET_PLATFORM)
HAL_LINK :=
PLATFORM_DFU = 0x8040000

DEPENDENCIES = newlib_nano modules/electron/user-part modules/electron/system-part1 modules/electron/system-part3 dynalib services services-dynalib hal platform system wiring communication-dynalib communication rt-dynalib wiring_globals
LIB_DEPENDENCIES = services-dynalib system wiring communication-dynalib hal platform wiring_globals
# newlib_nano is special in that it's linked automatically by the system, so no need to add it to the library path here
MAKE_DEPENDENCIES = newlib_nano $(LIB_DEPENDENCIES)

# exclude hal_usb
GLOBAL_DEFINES += HAL_USB_EXCLUDE=1 MODULE_HAS_SYSTEM_PART3=1

PLATFORM_DFU = 0x8020000

# Platform dependency is for the LED implementation used by rgbled.c in services.
MAKE_DEPENDENCIES = communication hal-dynalib services platform
DEPENDENCIES = $(MAKE_DEPENDENCIES) dynalib rt-dynalib modules/electron/system-part1 modules/electron/system-part3
include ../modular.mk
include $(PROJECT_ROOT)/build/platform-id.mk

LIBS += $(LIB_DEPENDENCIES)
LIB_DEPS += $(SERVICES_DYNALIB_LIB_DEP) $(PLATFORM_LIB_DEP) $(HAL_LIB_DEP) $(SYSTEM_LIB_DEP) $(COMMUNICATION_DYNALIB_LIB_DEP) $(WIRING_LIB_DEP) $(WIRING_GLOBALS_LIB_DEP)
LIBS += $(MAKE_DEPENDENCIES)
LIB_DEPS += $(COMMUNICATION_LIB_DEP) $(HAL_DYNALIB_LIB_DEP) $(SERVICES_LIB_DEP) $(PLATFORM_LIB_DEP)
LIB_DIRS += $(dir $(LIB_DEPS))

TARGET=elf bin lst hex size

TARGET=elf bin lst hex size

include $(PROJECT_ROOT)/build/arm-tlm.mk

Expand Down
4 changes: 4 additions & 0 deletions modules/electron/system-part2/src/init_dynalib.c
@@ -0,0 +1,4 @@

#define DYNALIB_EXPORT
#include "module_system_part1_init.h"
#include "module_system_part1_init_dynalib.h"
13 changes: 12 additions & 1 deletion modules/electron/system-part3/build.mk
@@ -1 +1,12 @@
include $(SHARED_MODULAR)/part3_build.mk

include ../../shared/stm32f2xx/part2_build.mk

# add dependency and directories for part3
LINKER_DEPS += $(SYSTEM_PART3_MODULE_PATH)/module_system_part3_export.ld
LDFLAGS += -L$(SYSTEM_PART3_MODULE_PATH)


LDFLAGS += -Wl,--defsym,__STACKSIZE__=1400
ASRC += $(COMMON_BUILD)/arm/startup/startup_$(STM32_DEVICE_LC).S
ASFLAGS += -I$(COMMON_BUILD)/arm/startup
ASFLAGS += -Wa,--defsym -Wa,SPARK_INIT_STARTUP=1
10 changes: 2 additions & 8 deletions modules/electron/system-part3/import.mk
@@ -1,9 +1,3 @@
include ../../shared/system_module_version.mk
SYSTEM_PART3_MODULE_PATH ?= $(PROJECT_ROOT)/modules/electron/system-part3
include $(call rwildcard,$(SYSTEM_PART3_MODULE_PATH)/,include.mk)
include $(call rwildcard,$(SHARED_MODULAR)/,include.mk)

MODULE_HAS_SYSTEM_PART3=1



SYSTEM_PART2_MODULE_PATH ?= $(PROJECT_ROOT)/modules/electron/system-part3
include $(call rwildcard,$(SYSTEM_PART2_MODULE_PATH)/,include.mk)
33 changes: 25 additions & 8 deletions modules/electron/system-part3/linker.ld
@@ -1,15 +1,32 @@
reset_handler = main;
ENTRY( reset_handler );


MEMORY
{
APP_FLASH (rx) : ORIGIN = 0x08060000, LENGTH = 128K
/*
SRAM is located immediately below system-part2, whcih has a base address
of 0x20200000-10K.
*/
SRAM (rwx) : ORIGIN = 0x20020000-6K-10K, LENGTH = 6K
DCT1_FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 16K
DCT2_FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 16K
APP_FLASH (rx) : ORIGIN = 0x08040000, LENGTH = 128K

/* The SRAM area is offset to include the stack and static ram allocated at the end of the SRAM area.
This is done so that the build outputs meaningful values for BSS and Data section sizes.

The value given here is the sum of system_static_ram_size and stack_size
*/
SRAM (rwx) : ORIGIN = 0x20020000 - 10K, LENGTH = 10K

INCLUDE backup_ram_memory.ld
}


/* Define the static locations of the part1 module so the dynamic invoke functions have the base address of each library table. */
INCLUDE module_system_part1_export.ld
INCLUDE module_system_part2_export.ld
INCLUDE module_system_part3_export.ld

INCLUDE ../../shared/stm32f2xx/part3.ld
/* Definitions for the stack size */
INCLUDE module_system_part2_export.ld

/* Definitions for the static parts of the user module */
INCLUDE module_user_export.ld

INCLUDE ../../shared/stm32f2xx/part2.ld
24 changes: 13 additions & 11 deletions modules/electron/system-part3/makefile
@@ -1,27 +1,29 @@
MODULE=system-part3
WIFI_SYSTEM_MODULE_PATH=.
PROJECT_ROOT=../../..
SYSTEM_PART2_MODULE_PATH=.
PROJECT_ROOT = ../../..
BUILD_PATH_EXT = $(BUILD_TARGET_PLATFORM)
HAL_LINK :=
PLATFORM_DFU = 0x8060000
PLATFORM_DFU = 0x8040000

LIB_DEPENDENCIES = services-dynalib rt-dynalib platform
MAKE_DEPENDENCIES = $(LIB_DEPENDENCIES)
DEPENDENCIES = newlib_nano modules/electron/user-part modules/electron/system-part1 modules/electron/system-part2 dynalib services services-dynalib hal platform system wiring communication-dynalib communication rt-dynalib wiring_globals
LIB_DEPENDENCIES = services-dynalib system wiring communication-dynalib hal platform wiring_globals
# newlib_nano is special in that it's linked automatically by the system, so no need to add it to the library path here
MAKE_DEPENDENCIES = newlib_nano $(LIB_DEPENDENCIES)

# exclude hal_usb
GLOBAL_DEFINES += HAL_USB_EXCLUDE=1 MODULE_HAS_SYSTEM_PART3=1

DEPENDENCIES = $(MAKE_DEPENDENCIES) dynalib services hal

# rebuild if the linker specs change for other modules
DEPENDENCIES += modules/electron/user-part modules/electron/system-part1 modules/electron/system-part2

include ../modular.mk
include $(PROJECT_ROOT)/build/platform-id.mk

LIBS += $(LIB_DEPENDENCIES)
LIB_DEPS += $(SERVICES_DYNALIB_LIB_DEP) $(RT_DYNALIB_LIB_DEP) $(PLATFORM_LIB_DEP)
LIB_DEPS += $(SERVICES_DYNALIB_LIB_DEP) $(PLATFORM_LIB_DEP) $(HAL_LIB_DEP) $(SYSTEM_LIB_DEP) $(COMMUNICATION_DYNALIB_LIB_DEP) $(WIRING_LIB_DEP) $(WIRING_GLOBALS_LIB_DEP)
LIB_DIRS += $(dir $(LIB_DEPS))


TARGET=elf bin lst hex size


include $(PROJECT_ROOT)/build/arm-tlm.mk

$(call check_modular)
Expand Down
4 changes: 0 additions & 4 deletions modules/electron/system-part3/src/init_dynalib.c

This file was deleted.