Skip to content

Commit

Permalink
FW-190. Adding missing SCons* files.
Browse files Browse the repository at this point in the history
  • Loading branch information
twatteyne committed Feb 3, 2014
1 parent 16c231e commit dd940a2
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 50 deletions.
152 changes: 104 additions & 48 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -176,57 +176,113 @@ elif env['toolchain']=='iar-proj':

elif env['toolchain']=='armgcc':

if env['board'] not in ['iot-lab_M3']:
if env['board'] not in ['cc2538','iot-lab_M3']:
raise SystemError('toolchain {0} can not be used for board {1}'.format(env['toolchain'],env['board']))

# compiler (C)
env.Replace(CC = 'arm-none-eabi-gcc')
if os.name=='nt':
env.Append(CCFLAGS = '-DHSE_VALUE=((uint32_t)16000000)')
if env['board']=='iot-lab_M3':

# compiler (C)
env.Replace(CC = 'arm-none-eabi-gcc')
if os.name=='nt':
env.Append(CCFLAGS = '-DHSE_VALUE=((uint32_t)16000000)')
else:
env.Append(CCFLAGS = '-DHSE_VALUE=\\(\\(uint32_t\\)16000000\\)')
env.Append(CCFLAGS = '-DSTM32F10X_HD')
env.Append(CCFLAGS = '-DUSE_STDPERIPH_DRIVER')
env.Append(CCFLAGS = '-ggdb')
env.Append(CCFLAGS = '-g3')
env.Append(CCFLAGS = '-std=gnu99')
env.Append(CCFLAGS = '-O0')
env.Append(CCFLAGS = '-Wall')
#env.Append(CCFLAGS = '-Wstrict-prototypes')
env.Append(CCFLAGS = '-mcpu=cortex-m3')
env.Append(CCFLAGS = '-mlittle-endian')
env.Append(CCFLAGS = '-mthumb')
env.Append(CCFLAGS = '-mthumb-interwork')
env.Append(CCFLAGS = '-nostartfiles')
# compiler (C++)
env.Replace(CXX = 'arm-none-eabi-g++')
# assembler
env.Replace(AS = 'arm-none-eabi-as')
env.Append(ASFLAGS = '-ggdb -g3 -mcpu=cortex-m3 -mlittle-endian')
# linker
env.Append(LINKFLAGS = '-DUSE_STDPERIPH_DRIVER')
env.Append(LINKFLAGS = '-DUSE_STM32_DISCOVERY')
env.Append(LINKFLAGS = '-g3')
env.Append(LINKFLAGS = '-ggdb')
env.Append(LINKFLAGS = '-mcpu=cortex-m3')
env.Append(LINKFLAGS = '-mlittle-endian')
env.Append(LINKFLAGS = '-static')
env.Append(LINKFLAGS = '-lgcc')
env.Append(LINKFLAGS = '-mthumb')
env.Append(LINKFLAGS = '-mthumb-interwork')
env.Append(LINKFLAGS = '-nostartfiles')
env.Append(LINKFLAGS = '-Tfirmware/openos/bsp/boards/iot-lab_M3/stm32_flash.ld')
# object manipulation
env.Replace(OBJCOPY = 'arm-none-eabi-objcopy')
env.Replace(OBJDUMP = 'arm-none-eabi-objdump')
# archiver
env.Replace(AR = 'arm-none-eabi-ar')
env.Append(ARFLAGS = '')
env.Replace(RANLIB = 'arm-none-eabi-ranlib')
env.Append(RANLIBFLAGS = '')
# misc
env.Replace(NM = 'arm-none-eabi-nm')
env.Replace(SIZE = 'arm-none-eabi-size')

elif env['board']=='cc2538':

# compiler (C)
env.Replace(CC = 'arm-none-eabi-gcc')
if os.name=='nt':
env.Append(CCFLAGS = '-DHSE_VALUE=((uint32_t)16000000)')
else:
env.Append(CCFLAGS = '-DHSE_VALUE=\\(\\(uint32_t\\)16000000\\)')
env.Append(CCFLAGS = '-DSTM32F10X_HD')
env.Append(CCFLAGS = '-DUSE_STDPERIPH_DRIVER')
env.Append(CCFLAGS = '-ggdb')
env.Append(CCFLAGS = '-g3')
env.Append(CCFLAGS = '-std=gnu99')
env.Append(CCFLAGS = '-O0')
env.Append(CCFLAGS = '-Wall')
#env.Append(CCFLAGS = '-Wstrict-prototypes')
env.Append(CCFLAGS = '-mcpu=cortex-m3')
env.Append(CCFLAGS = '-mlittle-endian')
env.Append(CCFLAGS = '-mthumb')
env.Append(CCFLAGS = '-mthumb-interwork')
env.Append(CCFLAGS = '-nostartfiles')
# compiler (C++)
env.Replace(CXX = 'arm-none-eabi-g++')
# assembler
env.Replace(AS = 'arm-none-eabi-as')
env.Append(ASFLAGS = '-ggdb -g3 -mcpu=cortex-m3 -mlittle-endian')
# linker
env.Append(LINKFLAGS = '-DUSE_STDPERIPH_DRIVER')
env.Append(LINKFLAGS = '-DUSE_STM32_DISCOVERY')
env.Append(LINKFLAGS = '-g3')
env.Append(LINKFLAGS = '-ggdb')
env.Append(LINKFLAGS = '-mcpu=cortex-m3')
env.Append(LINKFLAGS = '-mlittle-endian')
env.Append(LINKFLAGS = '-static')
env.Append(LINKFLAGS = '-lgcc')
env.Append(LINKFLAGS = '-mthumb')
env.Append(LINKFLAGS = '-mthumb-interwork')
env.Append(LINKFLAGS = '-nostartfiles')
env.Append(LINKFLAGS = '-Tfirmware/openos/bsp/boards/iot-lab_M3/stm32_flash.ld')
# object manipulation
env.Replace(OBJCOPY = 'arm-none-eabi-objcopy')
env.Replace(OBJDUMP = 'arm-none-eabi-objdump')
# archiver
env.Replace(AR = 'arm-none-eabi-ar')
env.Append(ARFLAGS = '')
env.Replace(RANLIB = 'arm-none-eabi-ranlib')
env.Append(RANLIBFLAGS = '')
# misc
env.Replace(NM = 'arm-none-eabi-nm')
env.Replace(SIZE = 'arm-none-eabi-size')

else:
env.Append(CCFLAGS = '-DHSE_VALUE=\\(\\(uint32_t\\)16000000\\)')
env.Append(CCFLAGS = '-DSTM32F10X_HD')
env.Append(CCFLAGS = '-DUSE_STDPERIPH_DRIVER')
env.Append(CCFLAGS = '-ggdb')
env.Append(CCFLAGS = '-g3')
env.Append(CCFLAGS = '-std=gnu99')
env.Append(CCFLAGS = '-O0')
env.Append(CCFLAGS = '-Wall')
#env.Append(CCFLAGS = '-Wstrict-prototypes')
env.Append(CCFLAGS = '-mcpu=cortex-m3')
env.Append(CCFLAGS = '-mlittle-endian')
env.Append(CCFLAGS = '-mthumb')
env.Append(CCFLAGS = '-mthumb-interwork')
env.Append(CCFLAGS = '-nostartfiles')
# compiler (C++)
env.Replace(CXX = 'arm-none-eabi-g++')
# assembler
env.Replace(AS = 'arm-none-eabi-as')
env.Append(ASFLAGS = '-ggdb -g3 -mcpu=cortex-m3 -mlittle-endian')
# linker
env.Append(LINKFLAGS = '-DUSE_STDPERIPH_DRIVER')
env.Append(LINKFLAGS = '-DUSE_STM32_DISCOVERY')
env.Append(LINKFLAGS = '-g3')
env.Append(LINKFLAGS = '-ggdb')
env.Append(LINKFLAGS = '-mcpu=cortex-m3')
env.Append(LINKFLAGS = '-mlittle-endian')
env.Append(LINKFLAGS = '-static')
env.Append(LINKFLAGS = '-lgcc')
env.Append(LINKFLAGS = '-mthumb')
env.Append(LINKFLAGS = '-mthumb-interwork')
env.Append(LINKFLAGS = '-nostartfiles')
env.Append(LINKFLAGS = '-Tfirmware/openos/bsp/boards/iot-lab_M3/stm32_flash.ld')
# object manipulation
env.Replace(OBJCOPY = 'arm-none-eabi-objcopy')
env.Replace(OBJDUMP = 'arm-none-eabi-objdump')
# archiver
env.Replace(AR = 'arm-none-eabi-ar')
env.Append(ARFLAGS = '')
env.Replace(RANLIB = 'arm-none-eabi-ranlib')
env.Append(RANLIBFLAGS = '')
# misc
env.Replace(NM = 'arm-none-eabi-nm')
env.Replace(SIZE = 'arm-none-eabi-size')
raise SystemError('unexpected board={0}'.format(env['board']))

# converts ELF to iHex
elf2iHexFunc = Builder(
Expand Down
23 changes: 21 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,27 @@ help-option:

# first value is default
command_line_options = {
'board': ['telosb','wsn430v14','wsn430v13b','gina','z1','python','iot-lab_M3','openmotestm'],
'toolchain': ['mspgcc','iar','iar-proj','armgcc','gcc'],
'board': [
# MSP430
'telosb',
'gina',
'wsn430v14',
'wsn430v13b',
'z1',
# Cortex-M3
'cc2538', # TODO: replace by openmotecc2538 when directory renamed
'openmotestm',
'iot-lab_M3',
# misc.
'python',
],
'toolchain': [
'mspgcc',
'iar',
'iar-proj',
'armgcc',
'gcc',
],
'fet_version': ['2','3'],
'verbose': ['0','1'],
'fastsim': ['1','0'],
Expand Down
31 changes: 31 additions & 0 deletions firmware/openos/bsp/boards/cc2538/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os

Import('env')

localEnv = env.Clone()

# scons doesn't let us look to parent directories for source, so the
# bsp/chips/at86rf231/radio.c is off limits from this file. To keep things
# simple, each SConscript file in bsp/chips/* will return a list of objects
# which can be appended to the source list. Don't forget to specify a variant_dir,
# or else the build will occur directly in the chips directory.

rf231 = localEnv.SConscript(
os.path.join('#','firmware','openos','bsp','chips','at86rf231','SConscript'),
variant_dir = 'rf231',
exports = {'env': env},
)

target = 'libbsp'
bsp_dir = os.path.join('#','firmware','openos','bsp','boards','iot-lab_M3')
source = \
Glob('*.c') + \
Glob('source/*.c') + \
[rf231]

libbsp = localEnv.Library(
target=target,
source=source,
)

Alias('libbsp', libbsp)
5 changes: 5 additions & 0 deletions firmware/openos/projects/cc2538/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os

Import('env')

env.SconscriptScanner()
27 changes: 27 additions & 0 deletions firmware/openos/projects/cc2538/SConscript.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

Import('env')

# create build environment
buildEnv = env.Clone()

# inherit environment from user (PATH, etc)
buildEnv['ENV'] = os.environ

# choose bsp. Normally this would be the same as the board name,
# however, there are cases where one might want to make separate build
# configuration for the same board.
buildEnv['BSP'] = buildEnv['board']

bsp_dir = os.path.join('#','firmware','openos','bsp','boards',buildEnv['board'])

# include board/bsp-specific directories
buildEnv.Append(
CPPPATH = [
bsp_dir,
os.path.join(bsp_dir,'inc'),
os.path.join(bsp_dir,'source'),
]
)

Return('buildEnv')

0 comments on commit dd940a2

Please sign in to comment.