mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
Thanks to the people@elua-dev list, I finally understood what's ARM EABI, so I thought I make good use of it :), so I enabled it for ALL ARM and Cortex targets alike. Now you can specify the toolchain to use like this:
$ scons board=... toolchain=arm-gcc|arm-gcc-eabi (the default is still arm-gcc, but this can be changed by editing SConstruct). This is a Very Good thing for us, because users won't need to build their own toolchains anymore, they can just download the one from CS and use it. Thanks again for this. Actually, the whole build system was changed to support arbitrary toolchains (although there's much work to be done in this area). Also, changed a few things in the STM32 port (the linker script file, the stack definitions). And other (very minor) changes (mostly to fix some compiler warnings).
This commit is contained in:
parent
9ac734be3c
commit
a2b915dd2f
83
SConstruct
83
SConstruct
@ -3,18 +3,53 @@ target = ARGUMENTS.get( 'target', 'lua' ).lower()
|
|||||||
cputype = ARGUMENTS.get( 'cpu', '' ).upper()
|
cputype = ARGUMENTS.get( 'cpu', '' ).upper()
|
||||||
allocator = ARGUMENTS.get( 'allocator', '' ).lower()
|
allocator = ARGUMENTS.get( 'allocator', '' ).lower()
|
||||||
boardname = ARGUMENTS.get( 'board' , '').upper()
|
boardname = ARGUMENTS.get( 'board' , '').upper()
|
||||||
cprefix = ARGUMENTS.get( 'cprefix', '')
|
toolchain = ARGUMENTS.get( 'toolchain', '')
|
||||||
optram = int( ARGUMENTS.get( 'optram', '1' ) )
|
optram = int( ARGUMENTS.get( 'optram', '1' ) )
|
||||||
|
|
||||||
# List of platform/CPU combinations
|
# List of toolchains
|
||||||
cpu_list = { 'at91sam7x' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
|
toolchain_list = {
|
||||||
'lm3s' : [ 'LM3S8962', 'LM3S6965' ],
|
'arm-gcc' : {
|
||||||
'str9' : [ 'STR912FW44' ],
|
'compile' : 'arm-elf-gcc',
|
||||||
'i386' : [ 'I386' ],
|
'link' : 'arm-elf-ld',
|
||||||
'lpc288x' : [ 'LPC2888' ],
|
'asm' : 'arm-elf-as',
|
||||||
'str7' : [ 'STR711FR2' ],
|
'bin' : 'arm-elf-objcopy',
|
||||||
'stm32' : [ 'STM32F103ZE' ],
|
'size' : 'arm-elf-size'
|
||||||
'avr32' : [ 'AT32UC3A0512' ]
|
},
|
||||||
|
'arm-gcc-eabi' : {
|
||||||
|
'compile' : 'arm-none-eabi-gcc',
|
||||||
|
'link' : 'arm-none-eabi-ld',
|
||||||
|
'asm' : 'arm-none-eabi-as',
|
||||||
|
'bin' : 'arm-none-eabi-objcopy',
|
||||||
|
'size' : 'arm-none-eabi-size'
|
||||||
|
},
|
||||||
|
'avr32-gcc' : {
|
||||||
|
'compile' : 'avr32-gcc',
|
||||||
|
'link' : 'avr32-ld',
|
||||||
|
'asm' : 'avr32-as',
|
||||||
|
'bin' : 'avr32-objcopy',
|
||||||
|
'size' : 'avr32-size'
|
||||||
|
},
|
||||||
|
'i686-gcc' : {
|
||||||
|
'compile' : 'i686-elf-gcc',
|
||||||
|
'link' : 'i686-elf-ld',
|
||||||
|
'asm' : 'nasm',
|
||||||
|
'bin' : 'i686-elf-objcopy',
|
||||||
|
'size' : 'i686-elf-size'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# List of platform/CPU/toolchains combinations
|
||||||
|
# The first toolchain in the toolchains list is the default one
|
||||||
|
# (the one that will be used if none is specified)
|
||||||
|
platform_list = {
|
||||||
|
'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ], 'toolchains' : [ 'arm-gcc', 'arm-gcc-eabi' ] },
|
||||||
|
'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965' ], 'toolchains' : [ 'arm-gcc', 'arm-gcc-eabi' ] },
|
||||||
|
'str9' : { 'cpus' : [ 'STR912FW44' ], 'toolchains' : [ 'arm-gcc', 'arm-gcc-eabi' ] },
|
||||||
|
'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
|
||||||
|
'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc', 'arm-gcc-eabi' ] },
|
||||||
|
'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc', 'arm-gcc-eabi' ] },
|
||||||
|
'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' : [ 'arm-gcc', 'arm-gcc-eabi' ] },
|
||||||
|
'avr32' : { 'cpus' : [ 'AT32UC3A0512' ], 'toolchains' : [ 'avr32-gcc' ] }
|
||||||
}
|
}
|
||||||
|
|
||||||
# List of board/CPU combinations
|
# List of board/CPU combinations
|
||||||
@ -26,7 +61,8 @@ board_list = { 'SAM7-EX256' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
|
|||||||
'LPC-H2888' : [ 'LPC2888' ],
|
'LPC-H2888' : [ 'LPC2888' ],
|
||||||
'MOD711' : [ 'STR711FR2' ],
|
'MOD711' : [ 'STR711FR2' ],
|
||||||
'STM3210E-EVAL' : [ 'STM32F103ZE' ],
|
'STM3210E-EVAL' : [ 'STM32F103ZE' ],
|
||||||
'ATEVK1100' : [ 'AT32UC3A0512' ]
|
'ATEVK1100' : [ 'AT32UC3A0512' ],
|
||||||
|
'ET-STM32' : [ 'STM32F103RE' ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# ROMFS file list "groups"
|
# ROMFS file list "groups"
|
||||||
@ -57,7 +93,8 @@ file_list = { 'SAM7-EX256' : [ 'bisect', 'hangman' , 'led', 'piano', 'hello', 'i
|
|||||||
'LPC-H2888' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ],
|
'LPC-H2888' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ],
|
||||||
'MOD711' : [ 'bisect', 'hangman', 'led', 'hello', 'info', 'dualpwm' ],
|
'MOD711' : [ 'bisect', 'hangman', 'led', 'hello', 'info', 'dualpwm' ],
|
||||||
'STM3210E-EVAL' : [ 'bisect', 'hello', 'info' ],
|
'STM3210E-EVAL' : [ 'bisect', 'hello', 'info' ],
|
||||||
'ATEVK1100' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ]
|
'ATEVK1100' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ],
|
||||||
|
'ET-STM32' : [ 'hello', 'info', 'bisect' ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Variants: board = <boardname>
|
# Variants: board = <boardname>
|
||||||
@ -93,22 +130,31 @@ else:
|
|||||||
print "CPU %s not found" % cputype
|
print "CPU %s not found" % cputype
|
||||||
sys.exit( -1 )
|
sys.exit( -1 )
|
||||||
|
|
||||||
platform = None
|
|
||||||
# Look for the given CPU in the list of platforms
|
# Look for the given CPU in the list of platforms
|
||||||
for p, v in cpu_list.items():
|
platform = None
|
||||||
if cputype in v:
|
for p, v in platform_list.items():
|
||||||
|
if cputype in v[ 'cpus' ]:
|
||||||
platform = p
|
platform = p
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print "Unknown CPU %s" % cputype
|
print "Unknown CPU %s" % cputype
|
||||||
print "List of accepted CPUs: "
|
print "List of accepted CPUs: "
|
||||||
for p, v in cpu_list.items():
|
for p, v in platform_list.items():
|
||||||
print " ", p, "-->",
|
print " ", p, "-->",
|
||||||
for cpu in v:
|
for cpu in v[ 'cpus' ]:
|
||||||
print cpu,
|
print cpu,
|
||||||
print
|
print
|
||||||
sys.exit( -1 )
|
sys.exit( -1 )
|
||||||
|
|
||||||
|
# Check the toolchain
|
||||||
|
if toolchain != '':
|
||||||
|
if not toolchain in platform_list[ platform ][ 'toolchains' ]:
|
||||||
|
print "Invalid toolchain '%s' for CPU '%s'" % ( toolchain, cputype )
|
||||||
|
sys.exit( -1 )
|
||||||
|
else:
|
||||||
|
toolchain = platform_list[ platform ][ 'toolchains' ][ 0 ]
|
||||||
|
toolset = toolchain_list[ toolchain ]
|
||||||
|
|
||||||
# CPU/allocator mapping (if allocator not specified)
|
# CPU/allocator mapping (if allocator not specified)
|
||||||
if allocator == '':
|
if allocator == '':
|
||||||
if boardname == 'LPC-H2888' or boardname == 'ATEVK1100':
|
if boardname == 'LPC-H2888' or boardname == 'ATEVK1100':
|
||||||
@ -130,7 +176,8 @@ if not GetOption( 'clean' ):
|
|||||||
print "Board: ", boardname
|
print "Board: ", boardname
|
||||||
print "Platform: ", platform
|
print "Platform: ", platform
|
||||||
print "Allocator: ", allocator
|
print "Allocator: ", allocator
|
||||||
print "Target: ", target
|
print "Target: ", target == 'lua' and 'fplua' or 'target'
|
||||||
|
print "Toolchain: ", toolchain
|
||||||
print "*********************************"
|
print "*********************************"
|
||||||
print
|
print
|
||||||
|
|
||||||
|
@ -30,15 +30,16 @@ ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
|||||||
|
|
||||||
# Toolset data
|
# Toolset data
|
||||||
tools[ 'at91sam7x' ] = {}
|
tools[ 'at91sam7x' ] = {}
|
||||||
tools[ 'at91sam7x' ][ 'cccom' ] = "arm-elf-gcc -mcpu=arm7tdmi %s %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( modeflag, opt, local_include, cdefs )
|
tools[ 'at91sam7x' ][ 'cccom' ] = "%s -mcpu=arm7tdmi %s %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], modeflag, opt, local_include, cdefs )
|
||||||
tools[ 'at91sam7x' ][ 'linkcom' ] = "arm-elf-gcc -nostartfiles -nostdlib %s -T %s -Wl,--gc-sections -Wl,-e,entry -Wl,--allow-multiple-definition -o $TARGET $SOURCES %s -lc -lgcc -lm" % ( modeflag, ldscript, local_libs )
|
tools[ 'at91sam7x' ][ 'linkcom' ] = "%s -nostartfiles -nostdlib %s -T %s -Wl,--gc-sections -Wl,-e,entry -Wl,--allow-multiple-definition -o $TARGET $SOURCES %s -lc -lgcc -lm" % ( toolset[ 'compile' ], modeflag, ldscript, local_libs )
|
||||||
tools[ 'at91sam7x' ][ 'ascom' ] = "arm-elf-gcc -x assembler-with-cpp %s -mcpu=arm7tdmi %s %s -D__ASSEMBLY__ -Wall -c $SOURCE -o $TARGET" % ( local_include, modeflag, cdefs )
|
tools[ 'at91sam7x' ][ 'ascom' ] = "%s -x assembler-with-cpp %s -mcpu=arm7tdmi %s %s -D__ASSEMBLY__ -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], local_include, modeflag, cdefs )
|
||||||
|
|
||||||
# Programming function for LPC2888
|
# Programming function for LPC2888
|
||||||
def progfunc_at91sam7x( target, source, env ):
|
def progfunc_at91sam7x( target, source, env ):
|
||||||
outname = output + ".elf"
|
outname = output + ".elf"
|
||||||
os.system( "arm-elf-size %s" % outname )
|
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||||
print "Generating binary image..."
|
print "Generating binary image..."
|
||||||
os.system( "arm-elf-objcopy -O binary %s %s.bin" % ( outname, output ) )
|
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||||
|
|
||||||
tools[ 'at91sam7x' ][ 'progfunc' ] = progfunc_at91sam7x
|
tools[ 'at91sam7x' ][ 'progfunc' ] = progfunc_at91sam7x
|
||||||
|
|
||||||
|
@ -64,6 +64,8 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_efixed = .;
|
_efixed = .;
|
||||||
PROVIDE(etext = .);
|
PROVIDE(etext = .);
|
||||||
|
_fini = .;
|
||||||
|
*(.fini)
|
||||||
} >flash
|
} >flash
|
||||||
|
|
||||||
.relocate : AT (_efixed)
|
.relocate : AT (_efixed)
|
||||||
@ -77,6 +79,18 @@ SECTIONS
|
|||||||
_erelocate = .;
|
_erelocate = .;
|
||||||
} >sram
|
} >sram
|
||||||
|
|
||||||
|
.ARM.extab :
|
||||||
|
{
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} >sram
|
||||||
|
|
||||||
|
__exidx_start = .;
|
||||||
|
.ARM.exidx :
|
||||||
|
{
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} >sram
|
||||||
|
__exidx_end = .;
|
||||||
|
|
||||||
.bss (NOLOAD) : {
|
.bss (NOLOAD) : {
|
||||||
_szero = .;
|
_szero = .;
|
||||||
*(.bss .bss.*)
|
*(.bss .bss.*)
|
||||||
|
@ -64,6 +64,8 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_efixed = .;
|
_efixed = .;
|
||||||
PROVIDE(etext = .);
|
PROVIDE(etext = .);
|
||||||
|
_fini = .;
|
||||||
|
*(.fini)
|
||||||
} >flash
|
} >flash
|
||||||
|
|
||||||
.relocate : AT (_efixed)
|
.relocate : AT (_efixed)
|
||||||
@ -77,6 +79,18 @@ SECTIONS
|
|||||||
_erelocate = .;
|
_erelocate = .;
|
||||||
} >sram
|
} >sram
|
||||||
|
|
||||||
|
.ARM.extab :
|
||||||
|
{
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} >sram
|
||||||
|
|
||||||
|
__exidx_start = .;
|
||||||
|
.ARM.exidx :
|
||||||
|
{
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} >sram
|
||||||
|
__exidx_end = .;
|
||||||
|
|
||||||
.bss (NOLOAD) : {
|
.bss (NOLOAD) : {
|
||||||
_szero = .;
|
_szero = .;
|
||||||
*(.bss .bss.*)
|
*(.bss .bss.*)
|
||||||
|
@ -168,7 +168,7 @@ pio_type platform_pio_op( unsigned port, pio_type pinmask, int op )
|
|||||||
|
|
||||||
case PLATFORM_IO_PORT_GET_VALUE:
|
case PLATFORM_IO_PORT_GET_VALUE:
|
||||||
pin->mask = 0x7FFFFFFF;
|
pin->mask = 0x7FFFFFFF;
|
||||||
pin->type = pinmask == PLATFORM_IO_READ_IN_MASK ? : PIO_INPUT : PIO_OUTPUT_0;
|
pin->type = pinmask == PLATFORM_IO_READ_IN_MASK ? PIO_INPUT : PIO_OUTPUT_0;
|
||||||
retval = PIO_Get( pin );
|
retval = PIO_Get( pin );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -11,16 +11,17 @@ ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
|||||||
|
|
||||||
# Toolset data
|
# Toolset data
|
||||||
tools[ 'avr32' ] = {}
|
tools[ 'avr32' ] = {}
|
||||||
tools[ 'avr32' ][ 'cccom' ] = "avr32-gcc -mpart=uc3a0512 %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( opt, local_include, cdefs )
|
tools[ 'avr32' ][ 'cccom' ] = "%s -mpart=uc3a0512 %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], opt, local_include, cdefs )
|
||||||
tools[ 'avr32' ][ 'linkcom' ] = "avr32-gcc -nostartfiles -nostdlib -T %s -Wl,--gc-sections -Wl,-e,crt0 -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lc -lgcc -lm %s" % ( ldscript, local_libs )
|
tools[ 'avr32' ][ 'linkcom' ] = "%s -nostartfiles -nostdlib -T %s -Wl,--gc-sections -Wl,-e,crt0 -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lc -lgcc -lm %s" % ( toolset[ 'compile' ], ldscript, local_libs )
|
||||||
tools[ 'avr32' ][ 'ascom' ] = "avr32-gcc -x assembler-with-cpp %s -mpart=uc3a0512 %s -Wall -c $SOURCE -o $TARGET" % ( local_include, cdefs )
|
tools[ 'avr32' ][ 'ascom' ] = "%s -x assembler-with-cpp %s -mpart=uc3a0512 %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], local_include, cdefs )
|
||||||
|
|
||||||
# Programming function
|
# Programming function
|
||||||
def progfunc_avr32( target, source, env ):
|
def progfunc_avr32( target, source, env ):
|
||||||
outname = output + ".elf"
|
outname = output + ".elf"
|
||||||
os.system( "avr32-size %s" % outname )
|
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||||
print "Generating binary image..."
|
print "Generating binary image..."
|
||||||
os.system( "avr32-objcopy -O ihex %s %s.hex" % ( outname, output ) )
|
os.system( "%s -O ihex %s %s.hex" % ( toolset[ 'bin' ], outname, output ) )
|
||||||
|
|
||||||
# print "Programming..."
|
# print "Programming..."
|
||||||
# os.system( "batchisp3.sh -hardware usb -device at32uc3a0512 -operation erase f memory flash blankcheck loadbuffer %s program verify start reset 0" % ( output + ".hex" ) )
|
# os.system( "batchisp3.sh -hardware usb -device at32uc3a0512 -operation erase f memory flash blankcheck loadbuffer %s program verify start reset 0" % ( output + ".hex" ) )
|
||||||
|
|
||||||
|
@ -9,14 +9,14 @@ ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
|||||||
|
|
||||||
# Toolset data
|
# Toolset data
|
||||||
tools[ 'i386' ] = {}
|
tools[ 'i386' ] = {}
|
||||||
tools[ 'i386' ][ 'cccom' ] = "i686-elf-gcc %s %s -march=i386 -mfpmath=387 -m32 -ffunction-sections -fdata-sections -fno-builtin -fno-stack-protector %s -Wall -c $SOURCE -o $TARGET" % ( opt, local_include, cdefs )
|
tools[ 'i386' ][ 'cccom' ] = "%s %s %s -march=i386 -mfpmath=387 -m32 -ffunction-sections -fdata-sections -fno-builtin -fno-stack-protector %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], opt, local_include, cdefs )
|
||||||
tools[ 'i386' ][ 'linkcom' ] = "i686-elf-gcc -nostartfiles -nostdlib -march=i386 -mfpmath=387 -m32 -T %s -Wl,--gc-sections -Wl,-e,start -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lc -lgcc -lm %s" % ( ldscript, local_libs )
|
tools[ 'i386' ][ 'linkcom' ] = "%s -nostartfiles -nostdlib -march=i386 -mfpmath=387 -m32 -T %s -Wl,--gc-sections -Wl,-e,start -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lc -lgcc -lm %s" % ( toolset[ 'compile' ], ldscript, local_libs )
|
||||||
tools[ 'i386' ][ 'ascom' ] = "nasm -felf $SOURCE"
|
tools[ 'i386' ][ 'ascom' ] = "%s -felf $SOURCE" % toolset[ 'asm' ]
|
||||||
|
|
||||||
# Programming function for i386 (not needed, empty function)
|
# Programming function for i386 (not needed, empty function)
|
||||||
def progfunc_i386( target, source, env ):
|
def progfunc_i386( target, source, env ):
|
||||||
outname = output + ".elf"
|
outname = output + ".elf"
|
||||||
os.system( "i686-elf-size %s" % outname )
|
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||||
print "Visit http://www.eluaproject.net for instructions on how to use your eLua ELF file"
|
print "Visit http://www.eluaproject.net for instructions on how to use your eLua ELF file"
|
||||||
|
|
||||||
tools[ 'i386' ][ 'progfunc' ] = progfunc_i386
|
tools[ 'i386' ][ 'progfunc' ] = progfunc_i386
|
||||||
|
@ -7,12 +7,6 @@ if boardname == 'EK-LM3S6965' or boardname == 'EK-LM3S8962':
|
|||||||
|
|
||||||
ldscript = "lm3s.ld"
|
ldscript = "lm3s.ld"
|
||||||
|
|
||||||
# Use default toolchain prefix if one isn't provided
|
|
||||||
if cprefix == '':
|
|
||||||
cprefix= "arm-elf-"
|
|
||||||
else:
|
|
||||||
cprefix = cprefix + '-'
|
|
||||||
|
|
||||||
# Prepend with path
|
# Prepend with path
|
||||||
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||||
@ -21,20 +15,15 @@ cdefs = cdefs + " -DFOR" + cputype + " -Dgcc"
|
|||||||
|
|
||||||
# Toolset data
|
# Toolset data
|
||||||
tools[ 'lm3s' ] = {}
|
tools[ 'lm3s' ] = {}
|
||||||
tools[ 'lm3s' ][ 'cccom' ] = cprefix + "gcc -mcpu=cortex-m3 -mthumb %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( opt, local_include, cdefs )
|
tools[ 'lm3s' ][ 'cccom' ] = "%s -mcpu=cortex-m3 -mthumb %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], opt, local_include, cdefs )
|
||||||
|
tools[ 'lm3s' ][ 'linkcom' ] = "%s -mthumb -mcpu=cortex-m3 -nostartfiles -T %s -Wl,--gc-sections -Wl,-e,ResetISR -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lm %s" % ( toolset[ 'compile' ], ldscript, local_libs )
|
||||||
if cprefix == 'arm-elf-':
|
tools[ 'lm3s' ][ 'ascom' ] = "%s -x assembler-with-cpp %s -mcpu=cortex-m3 -mthumb %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], local_include, cdefs )
|
||||||
tools[ 'lm3s' ][ 'linkcom' ] = cprefix + "gcc -nostartfiles -nostdlib -T %s -Wl,--gc-sections -Wl,-e,ResetISR -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lc -lgcc -lm %s" % ( ldscript, local_libs )
|
|
||||||
else:
|
|
||||||
tools[ 'lm3s' ][ 'linkcom' ] = cprefix + "gcc -mthumb -mcpu=cortex-m3 -nostartfiles -T %s -Wl,--gc-sections -Wl,-e,ResetISR -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lm %s" % ( ldscript, local_libs )
|
|
||||||
|
|
||||||
tools[ 'lm3s' ][ 'ascom' ] = cprefix + "gcc -x assembler-with-cpp %s -mcpu=cortex-m3 -mthumb %s -Wall -c $SOURCE -o $TARGET" % ( local_include, cdefs )
|
|
||||||
|
|
||||||
# Programming function
|
# Programming function
|
||||||
def progfunc_lm3s( target, source, env ):
|
def progfunc_lm3s( target, source, env ):
|
||||||
outname = output + ".elf"
|
outname = output + ".elf"
|
||||||
os.system( cprefix + "size %s" % outname )
|
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||||
print "Generating binary image..."
|
print "Generating binary image..."
|
||||||
os.system( cprefix + "objcopy -O binary %s %s.bin" % ( outname, output ) )
|
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||||
|
|
||||||
tools[ 'lm3s' ][ 'progfunc' ] = progfunc_lm3s
|
tools[ 'lm3s' ][ 'progfunc' ] = progfunc_lm3s
|
||||||
|
@ -31,15 +31,15 @@ ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
|||||||
|
|
||||||
# Toolset data
|
# Toolset data
|
||||||
tools[ 'lpc288x' ] = {}
|
tools[ 'lpc288x' ] = {}
|
||||||
tools[ 'lpc288x' ][ 'cccom' ] = "arm-elf-gcc -mcpu=arm7tdmi %s %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( opt, local_include, modeflag, cdefs )
|
tools[ 'lpc288x' ][ 'cccom' ] = "%s -mcpu=arm7tdmi %s %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], opt, local_include, modeflag, cdefs )
|
||||||
tools[ 'lpc288x' ][ 'linkcom' ] = "arm-elf-gcc -mcpu=arm7tdmi -nostartfiles -nostdlib %s -T %s -Wl,--gc-sections -Wl,-e,HardReset -Wl,--allow-multiple-definition -o $TARGET $SOURCES %s -lc -lgcc -lm" % ( modeflag, ldscript, local_libs )
|
tools[ 'lpc288x' ][ 'linkcom' ] = "%s -mcpu=arm7tdmi -nostartfiles -nostdlib %s -T %s -Wl,--gc-sections -Wl,-e,HardReset -Wl,--allow-multiple-definition -o $TARGET $SOURCES %s -lc -lgcc -lm" % ( toolset[ 'compile' ], modeflag, ldscript, local_libs )
|
||||||
tools[ 'lpc288x' ][ 'ascom' ] = "arm-elf-gcc -x assembler-with-cpp %s -mcpu=arm7tdmi %s %s -Wall -c $SOURCE -o $TARGET" % ( local_include, modeflag, cdefs )
|
tools[ 'lpc288x' ][ 'ascom' ] = "%s -x assembler-with-cpp %s -mcpu=arm7tdmi %s %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], local_include, modeflag, cdefs )
|
||||||
|
|
||||||
# Programming function for LPC2888
|
# Programming function for LPC2888
|
||||||
def progfunc_lpc288x( target, source, env ):
|
def progfunc_lpc288x( target, source, env ):
|
||||||
outname = output + ".elf"
|
outname = output + ".elf"
|
||||||
os.system( "arm-elf-size %s" % outname )
|
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||||
print "Generating binary image..."
|
print "Generating binary image..."
|
||||||
os.system( "arm-elf-objcopy -O binary %s %s.bin" % ( outname, output ) )
|
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||||
|
|
||||||
tools[ 'lpc288x' ][ 'progfunc' ] = progfunc_lpc288x
|
tools[ 'lpc288x' ][ 'progfunc' ] = progfunc_lpc288x
|
||||||
|
@ -25,6 +25,8 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_efixed = .;
|
_efixed = .;
|
||||||
PROVIDE(etext = .);
|
PROVIDE(etext = .);
|
||||||
|
_fini = .;
|
||||||
|
*(.fini)
|
||||||
} >flash
|
} >flash
|
||||||
|
|
||||||
.relocate : AT (_efixed)
|
.relocate : AT (_efixed)
|
||||||
@ -37,6 +39,18 @@ SECTIONS
|
|||||||
_erelocate = .;
|
_erelocate = .;
|
||||||
} >sram
|
} >sram
|
||||||
|
|
||||||
|
.ARM.extab :
|
||||||
|
{
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} >sram
|
||||||
|
|
||||||
|
__exidx_start = .;
|
||||||
|
.ARM.exidx :
|
||||||
|
{
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} >sram
|
||||||
|
__exidx_end = .;
|
||||||
|
|
||||||
.bss (NOLOAD) : {
|
.bss (NOLOAD) : {
|
||||||
_szero = .;
|
_szero = .;
|
||||||
*(.bss .bss.*)
|
*(.bss .bss.*)
|
||||||
|
@ -23,17 +23,17 @@ cdefs = cdefs + " -Dgcc"
|
|||||||
|
|
||||||
# Toolset data
|
# Toolset data
|
||||||
tools[ 'stm32' ] = {}
|
tools[ 'stm32' ] = {}
|
||||||
tools[ 'stm32' ][ 'cccom' ] = "arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mlittle-endian %s %s -ffunction-sections -fdata-sections -fno-strict-aliasing %s -Wall -c $SOURCE -o $TARGET" % ( opt, local_include, cdefs )
|
tools[ 'stm32' ][ 'cccom' ] = "%s -mcpu=cortex-m3 -mthumb -mlittle-endian %s %s -ffunction-sections -fdata-sections -fno-strict-aliasing %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], opt, local_include, cdefs )
|
||||||
#tools[ 'stm32' ][ 'linkcom' ] = "arm-none-eabi-gcc -nostartfiles -nostdlib -T %s -Wl,--gc-sections -Wl,-e,ResetISR -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lc -lgcc -lm %s" % ( ldscript, local_libs )
|
tools[ 'stm32' ][ 'linkcom' ] = "%s -mcpu=cortex-m3 -mthumb -Wl,-T -Xlinker %s -u _start -Wl,-e,Reset_Handler -Wl,-static -Wl,--gc-sections -nostartfiles -nostdlib -Wl,-Map -Xlinker project.map -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lc -lgcc -lm %s" % ( toolset[ 'compile' ], ldscript, local_libs )
|
||||||
tools[ 'stm32' ][ 'linkcom' ] = "arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wl,-T -Xlinker %s -u _start -Wl,-e,Reset_Handler -Wl,-static -Wl,--gc-sections -nostartfiles -nostdlib -Wl,-Map -Xlinker project.map -Wl,--allow-multiple-definition -o $TARGET $SOURCES -lc -lgcc -lm %s" % ( ldscript, local_libs )
|
tools[ 'stm32' ][ 'ascom' ] = "%s -x assembler-with-cpp %s -mcpu=cortex-m3 -mthumb %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], local_include, cdefs )
|
||||||
tools[ 'stm32' ][ 'ascom' ] = "arm-none-eabi-gcc -x assembler-with-cpp %s -mcpu=cortex-m3 -mthumb %s -Wall -c $SOURCE -o $TARGET" % ( local_include, cdefs )
|
|
||||||
|
|
||||||
# Programming function
|
# Programming function
|
||||||
def progfunc_stm32( target, source, env ):
|
def progfunc_stm32( target, source, env ):
|
||||||
outname = output + ".elf"
|
outname = output + ".elf"
|
||||||
os.system( "arm-none-eabi-size %s" % outname )
|
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||||
print "Generating binary image..."
|
print "Generating binary image..."
|
||||||
os.system( "arm-none-eabi-objcopy -O binary %s %s.bin" % ( outname, output ) )
|
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||||
os.system( "arm-none-eabi-objcopy -O ihex %s %s.hex" % ( outname, output ) )
|
os.system( "%s -O ihex %s %s.hex" % ( toolset[ 'bin' ], outname, output ) )
|
||||||
|
|
||||||
tools[ 'stm32' ][ 'progfunc' ] = progfunc_stm32
|
tools[ 'stm32' ][ 'progfunc' ] = progfunc_stm32
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "auxmods.h"
|
#include "auxmods.h"
|
||||||
#include "type.h"
|
#include "type.h"
|
||||||
|
#include "stacks.h"
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
// Define here what components you want for this platform
|
// Define here what components you want for this platform
|
||||||
@ -18,7 +19,6 @@
|
|||||||
//#define BUILD_DNS
|
//#define BUILD_DNS
|
||||||
#define BUILD_CON_GENERIC
|
#define BUILD_CON_GENERIC
|
||||||
//#define BUILD_CON_TCP
|
//#define BUILD_CON_TCP
|
||||||
#define EXTENDED_PLATFORM_DATA
|
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
// UART/Timer IDs configuration data (used in main.c)
|
// UART/Timer IDs configuration data (used in main.c)
|
||||||
@ -34,24 +34,14 @@
|
|||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
// Auxiliary libraries that will be compiled for this platform
|
// Auxiliary libraries that will be compiled for this platform
|
||||||
|
|
||||||
|
#ifdef FORSTM3210E_EVAL
|
||||||
#define AUXLIB_LCD "stm3210lcd"
|
#define AUXLIB_LCD "stm3210lcd"
|
||||||
LUALIB_API int ( luaopen_lcd )( lua_State* L );
|
LUALIB_API int ( luaopen_lcd )( lua_State* L );
|
||||||
|
#define LCDLINE _ROM( AUXLIB_LCD, luaopen_lcd, lcd_map )
|
||||||
#if 0
|
|
||||||
#define LUA_PLATFORM_LIBS\
|
|
||||||
{ AUXLIB_PIO, luaopen_pio },\
|
|
||||||
{ AUXLIB_SPI, luaopen_spi },\
|
|
||||||
{ AUXLIB_TMR, luaopen_tmr },\
|
|
||||||
{ AUXLIB_PD, luaopen_pd },\
|
|
||||||
{ AUXLIB_UART, luaopen_uart },\
|
|
||||||
{ AUXLIB_TERM, luaopen_term },\
|
|
||||||
{ AUXLIB_PWM, luaopen_pwm },\
|
|
||||||
{ AUXLIB_PACK, luaopen_pack },\
|
|
||||||
{ AUXLIB_BIT, luaopen_bit },\
|
|
||||||
{ AUXLIB_NET, luaopen_net },\
|
|
||||||
{ AUXLIB_CPU, luaopen_cpu },\
|
|
||||||
{ LUA_MATHLIBNAME, luaopen_math }
|
|
||||||
#else
|
#else
|
||||||
|
#define LCDLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LUA_PLATFORM_LIBS_ROM\
|
#define LUA_PLATFORM_LIBS_ROM\
|
||||||
_ROM( AUXLIB_PIO, luaopen_pio, pio_map )\
|
_ROM( AUXLIB_PIO, luaopen_pio, pio_map )\
|
||||||
_ROM( AUXLIB_PD, luaopen_pd, pd_map )\
|
_ROM( AUXLIB_PD, luaopen_pd, pd_map )\
|
||||||
@ -60,9 +50,8 @@ LUALIB_API int ( luaopen_lcd )( lua_State* L );
|
|||||||
_ROM( AUXLIB_PACK, luaopen_pack, pack_map )\
|
_ROM( AUXLIB_PACK, luaopen_pack, pack_map )\
|
||||||
_ROM( AUXLIB_BIT, luaopen_bit, bit_map )\
|
_ROM( AUXLIB_BIT, luaopen_bit, bit_map )\
|
||||||
_ROM( AUXLIB_CPU, luaopen_cpu, cpu_map )\
|
_ROM( AUXLIB_CPU, luaopen_cpu, cpu_map )\
|
||||||
_ROM( AUXLIB_LCD, luaopen_lcd, lcd_map )\
|
LCDLINE\
|
||||||
_ROM( LUA_MATHLIBNAME, luaopen_math, math_map )
|
_ROM( LUA_MATHLIBNAME, luaopen_math, math_map )
|
||||||
#endif
|
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
// Configuration data
|
// Configuration data
|
||||||
@ -117,10 +106,9 @@ u32 platform_s_cpu_get_frequency();
|
|||||||
|
|
||||||
// Allocator data: define your free memory zones here in two arrays
|
// Allocator data: define your free memory zones here in two arrays
|
||||||
// (start address and end address)
|
// (start address and end address)
|
||||||
#define STACK_SIZE 256
|
|
||||||
#define SRAM_SIZE ( 64 * 1024 )
|
#define SRAM_SIZE ( 64 * 1024 )
|
||||||
#define MEM_START_ADDRESS { ( void* )end }
|
#define MEM_START_ADDRESS { ( void* )end }
|
||||||
#define MEM_END_ADDRESS { ( void* )( SRAM_BASE + SRAM_SIZE - STACK_SIZE - 1 ) }
|
#define MEM_END_ADDRESS { ( void* )( SRAM_BASE + SRAM_SIZE - STACK_SIZE_TOTAL - 1 ) }
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
// CPU constants that should be exposed to the eLua "cpu" module
|
// CPU constants that should be exposed to the eLua "cpu" module
|
||||||
|
9
src/platform/stm32/stacks.h
Normal file
9
src/platform/stm32/stacks.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Stack size definitions
|
||||||
|
|
||||||
|
#ifndef __STACKS_H__
|
||||||
|
#define __STACKS_H__
|
||||||
|
|
||||||
|
#define STACK_SIZE 2048
|
||||||
|
#define STACK_SIZE_TOTAL ( STACK_SIZE )
|
||||||
|
|
||||||
|
#endif
|
@ -1,244 +1,66 @@
|
|||||||
/*
|
|
||||||
Default linker script for STM32F10x_512K_64K
|
|
||||||
Copyright RAISONANCE S.A.S. 2008
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* include the common STM32F10x sub-script */
|
|
||||||
|
|
||||||
/* Common part of the linker scripts for STM32 devices*/
|
|
||||||
|
|
||||||
|
|
||||||
/* default stack sizes.
|
|
||||||
|
|
||||||
These are used by the startup in order to allocate stacks for the different modes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
__Stack_Size = 2048 ;
|
|
||||||
|
|
||||||
PROVIDE ( _Stack_Size = __Stack_Size ) ;
|
|
||||||
|
|
||||||
__Stack_Init = _estack - __Stack_Size ;
|
|
||||||
|
|
||||||
/*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/
|
|
||||||
PROVIDE ( _Stack_Init = __Stack_Init ) ;
|
|
||||||
|
|
||||||
/*
|
|
||||||
There will be a link error if there is not this amount of RAM free at the end.
|
|
||||||
*/
|
|
||||||
_Minimum_Stack_Size = 0x100 ;
|
|
||||||
|
|
||||||
|
|
||||||
/* include the memory spaces definitions sub-script */
|
|
||||||
/*
|
|
||||||
Linker subscript for STM32F10x definitions with 512K Flash and 64K RAM */
|
|
||||||
|
|
||||||
/* Memory Spaces Definitions */
|
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
|
sram (W!RX) : ORIGIN = 0x20000000, LENGTH = 64k
|
||||||
EXTSRAM (xrw) : ORIGIN = 0x68000000, LENGTH = 8192K
|
flash (RX) : ORIGIN = 0x08000000, LENGTH = 512k
|
||||||
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
|
|
||||||
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
|
|
||||||
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
|
|
||||||
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
|
|
||||||
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
|
|
||||||
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* higher address of the user mode stack */
|
|
||||||
_estack = 0x20010000;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* include the sections management sub-script for FLASH mode */
|
|
||||||
|
|
||||||
/* Sections Definitions */
|
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
|
|
||||||
.isr_vector :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.isr_vector)) /* Startup code */
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
/* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
|
|
||||||
.flashtext :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.flashtext) /* Startup code */
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
/* the program code is stored in the .text section, which goes to Flash */
|
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
|
_text = .;
|
||||||
PROVIDE(stext = .);
|
PROVIDE(stext = .);
|
||||||
*(.text) /* remaining code */
|
KEEP(*(.isr_vector))
|
||||||
*(.text.*) /* remaining code */
|
KEEP(*(.init))
|
||||||
*(.rodata) /* read-only data (constants) */
|
*(.text .text.*)
|
||||||
*(.rodata*)
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
*(.glue_7)
|
*(.glue_7)
|
||||||
*(.glue_7t)
|
*(.glue_7t)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_etext = .;
|
_etext = .;
|
||||||
PROVIDE(etext = .);
|
PROVIDE(etext = .);
|
||||||
/* This is used by the startup in order to initialize the .data secion */
|
_fini = . ;
|
||||||
_sidata = _etext;
|
*(.fini)
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
|
} >flash
|
||||||
|
|
||||||
|
.data : AT (_etext)
|
||||||
/* This is the initialized data section
|
|
||||||
The program executes knowing that the data is in the RAM
|
|
||||||
but the loader puts the initial values in the FLASH (inidata).
|
|
||||||
It is one task of the startup to copy the initial values from FLASH to RAM. */
|
|
||||||
.data : AT ( _sidata )
|
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
/* This is used by the startup in order to initialize the .data secion */
|
_data = .;
|
||||||
_sdata = . ;
|
*(.ramfunc .ramfunc.* .fastrun .fastrun.*)
|
||||||
|
*(.data .data.*)
|
||||||
*(.data)
|
*(.gnu.linkonce.d.*)
|
||||||
*(.data.*)
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
/* This is used by the startup in order to initialize the .data secion */
|
|
||||||
_edata = .;
|
_edata = .;
|
||||||
} >RAM
|
} >sram
|
||||||
|
|
||||||
|
.ARM.extab :
|
||||||
|
|
||||||
/* This is the uninitialized data section */
|
|
||||||
.bss :
|
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
*(.ARM.extab*)
|
||||||
/* This is used by the startup in order to initialize the .bss secion */
|
} >sram
|
||||||
_sbss = .;
|
|
||||||
|
|
||||||
*(.bss)
|
__exidx_start = .;
|
||||||
*(.bss.*)
|
.ARM.exidx :
|
||||||
|
{
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} >sram
|
||||||
|
__exidx_end = .;
|
||||||
|
|
||||||
|
.bss (NOLOAD) : {
|
||||||
|
_bss = .;
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
/* This is used by the startup in order to initialize the .bss secion */
|
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
} >RAM
|
} >sram
|
||||||
|
|
||||||
PROVIDE ( end = _ebss );
|
end = .;
|
||||||
PROVIDE ( _end = _ebss );
|
PROVIDE( _estack = 0x20010000 );
|
||||||
|
|
||||||
/* This is the user stack section
|
|
||||||
This is just to check that there is enough RAM left for the User mode stack
|
|
||||||
It should generate an error if it's full.
|
|
||||||
*/
|
|
||||||
._usrstack :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
_susrstack = . ;
|
|
||||||
|
|
||||||
. = . + _Minimum_Stack_Size ;
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_eusrstack = . ;
|
|
||||||
} >RAM
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* this is the FLASH Bank1 */
|
|
||||||
/* the C or assembly source must explicitly place the code or data there
|
|
||||||
using the "section" attribute */
|
|
||||||
.b1text :
|
|
||||||
{
|
|
||||||
*(.b1text) /* remaining code */
|
|
||||||
*(.b1rodata) /* read-only data (constants) */
|
|
||||||
*(.b1rodata*)
|
|
||||||
} >FLASHB1
|
|
||||||
|
|
||||||
/* this is the EXTMEM */
|
|
||||||
/* the C or assembly source must explicitly place the code or data there
|
|
||||||
using the "section" attribute */
|
|
||||||
|
|
||||||
/* EXTMEM Bank0 */
|
|
||||||
.eb0text :
|
|
||||||
{
|
|
||||||
*(.eb0text) /* remaining code */
|
|
||||||
*(.eb0rodata) /* read-only data (constants) */
|
|
||||||
*(.eb0rodata*)
|
|
||||||
} >EXTMEMB0
|
|
||||||
|
|
||||||
/* EXTMEM Bank1 */
|
|
||||||
.eb1text :
|
|
||||||
{
|
|
||||||
*(.eb1text) /* remaining code */
|
|
||||||
*(.eb1rodata) /* read-only data (constants) */
|
|
||||||
*(.eb1rodata*)
|
|
||||||
} >EXTMEMB1
|
|
||||||
|
|
||||||
/* EXTMEM Bank2 */
|
|
||||||
.eb2text :
|
|
||||||
{
|
|
||||||
*(.eb2text) /* remaining code */
|
|
||||||
*(.eb2rodata) /* read-only data (constants) */
|
|
||||||
*(.eb2rodata*)
|
|
||||||
} >EXTMEMB2
|
|
||||||
|
|
||||||
/* EXTMEM Bank0 */
|
|
||||||
.eb3text :
|
|
||||||
{
|
|
||||||
*(.eb3text) /* remaining code */
|
|
||||||
*(.eb3rodata) /* read-only data (constants) */
|
|
||||||
*(.eb3rodata*)
|
|
||||||
} >EXTMEMB3
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* after that it's only debugging information. */
|
|
||||||
|
|
||||||
/* remove the debugging information from the standard libraries */
|
|
||||||
DISCARD :
|
|
||||||
{
|
|
||||||
libc.a ( * )
|
|
||||||
libm.a ( * )
|
|
||||||
libgcc.a ( * )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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) }
|
|
||||||
}
|
|
||||||
|
@ -40,16 +40,15 @@ typedef union { intfunc __fun; void * __ptr; } intvec_elem;
|
|||||||
extern unsigned long _etext;
|
extern unsigned long _etext;
|
||||||
/* start address for the initialization values of the .data section.
|
/* start address for the initialization values of the .data section.
|
||||||
defined in linker script */
|
defined in linker script */
|
||||||
extern unsigned long _sidata;
|
|
||||||
|
|
||||||
/* start address for the .data section. defined in linker script */
|
/* start address for the .data section. defined in linker script */
|
||||||
extern unsigned long _sdata;
|
extern unsigned long _data;
|
||||||
|
|
||||||
/* end address for the .data section. defined in linker script */
|
/* end address for the .data section. defined in linker script */
|
||||||
extern unsigned long _edata;
|
extern unsigned long _edata;
|
||||||
|
|
||||||
/* start address for the .bss section. defined in linker script */
|
/* start address for the .bss section. defined in linker script */
|
||||||
extern unsigned long _sbss;
|
extern unsigned long _bss;
|
||||||
|
|
||||||
/* end address for the .bss section. defined in linker script */
|
/* end address for the .bss section. defined in linker script */
|
||||||
extern unsigned long _ebss;
|
extern unsigned long _ebss;
|
||||||
@ -194,13 +193,13 @@ unsigned long *pulSrc, *pulDest;
|
|||||||
|
|
||||||
|
|
||||||
/* Copy the data segment initializers from flash to SRAM */
|
/* Copy the data segment initializers from flash to SRAM */
|
||||||
pulSrc = &_sidata;
|
pulSrc = &_etext;
|
||||||
for(pulDest = &_sdata; pulDest < &_edata; )
|
for(pulDest = &_data; pulDest < &_edata; )
|
||||||
{
|
{
|
||||||
*(pulDest++) = *(pulSrc++);
|
*(pulDest++) = *(pulSrc++);
|
||||||
}
|
}
|
||||||
/* Zero fill the bss segment. */
|
/* Zero fill the bss segment. */
|
||||||
for(pulDest = &_sbss; pulDest < &_ebss; )
|
for(pulDest = &_bss; pulDest < &_ebss; )
|
||||||
{
|
{
|
||||||
*(pulDest++) = 0;
|
*(pulDest++) = 0;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ void SysTick_Config(void)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void Delay(u32 nCount)
|
void Delay(u32 nCount)
|
||||||
{
|
{
|
||||||
printf("Delay(%d)\n", nCount);
|
printf("Delay(%u)\n", (unsigned)nCount);
|
||||||
TimingDelay = nCount;
|
TimingDelay = nCount;
|
||||||
|
|
||||||
/* Enable the SysTick Counter */
|
/* Enable the SysTick Counter */
|
||||||
|
@ -24,15 +24,15 @@ ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
|||||||
|
|
||||||
# Toolset data
|
# Toolset data
|
||||||
tools[ 'str7' ] = {}
|
tools[ 'str7' ] = {}
|
||||||
tools[ 'str7' ][ 'cccom' ] = "arm-elf-gcc -mcpu=arm7tdmi %s %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( modeflag, opt, local_include, cdefs )
|
tools[ 'str7' ][ 'cccom' ] = "%s -mcpu=arm7tdmi %s %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], modeflag, opt, local_include, cdefs )
|
||||||
tools[ 'str7' ][ 'linkcom' ] = "arm-elf-gcc -nostartfiles -nostdlib %s -T %s -Wl,--gc-sections -Wl,-e,entry -Wl,--allow-multiple-definition -o $TARGET $SOURCES %s -lc -lgcc -lm" % ( modeflag, ldscript, local_libs )
|
tools[ 'str7' ][ 'linkcom' ] = "%s -nostartfiles -nostdlib %s -T %s -Wl,--gc-sections -Wl,-e,entry -Wl,--allow-multiple-definition -o $TARGET $SOURCES %s -lc -lgcc -lm" % ( toolset[ 'compile' ], modeflag, ldscript, local_libs )
|
||||||
tools[ 'str7' ][ 'ascom' ] = "arm-elf-gcc -x assembler-with-cpp %s -mcpu=arm7tdmi %s %s -Wall -c $SOURCE -o $TARGET" % ( local_include, modeflag, cdefs )
|
tools[ 'str7' ][ 'ascom' ] = "%s -x assembler-with-cpp %s -mcpu=arm7tdmi %s %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], local_include, modeflag, cdefs )
|
||||||
|
|
||||||
# Programming function for LPC2888
|
# Programming function for LPC2888
|
||||||
def progfunc_str7( target, source, env ):
|
def progfunc_str7( target, source, env ):
|
||||||
outname = output + ".elf"
|
outname = output + ".elf"
|
||||||
os.system( "arm-elf-size %s" % outname )
|
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||||
print "Generating binary image..."
|
print "Generating binary image..."
|
||||||
os.system( "arm-elf-objcopy -O binary %s %s.bin" % ( outname, output ) )
|
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||||
|
|
||||||
tools[ 'str7' ][ 'progfunc' ] = progfunc_str7
|
tools[ 'str7' ][ 'progfunc' ] = progfunc_str7
|
||||||
|
@ -27,6 +27,8 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_efixed = .;
|
_efixed = .;
|
||||||
PROVIDE(etext = .);
|
PROVIDE(etext = .);
|
||||||
|
_fini = .;
|
||||||
|
*(.fini)
|
||||||
} >flash
|
} >flash
|
||||||
|
|
||||||
.relocate : AT (_efixed)
|
.relocate : AT (_efixed)
|
||||||
@ -40,6 +42,18 @@ SECTIONS
|
|||||||
_erelocate = .;
|
_erelocate = .;
|
||||||
} >sram
|
} >sram
|
||||||
|
|
||||||
|
.ARM.extab :
|
||||||
|
{
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} >sram
|
||||||
|
|
||||||
|
__exidx_start = .;
|
||||||
|
.ARM.exidx :
|
||||||
|
{
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} >sram
|
||||||
|
__exidx_end = .;
|
||||||
|
|
||||||
.bss (NOLOAD) : {
|
.bss (NOLOAD) : {
|
||||||
_szero = .;
|
_szero = .;
|
||||||
*(.bss .bss.*)
|
*(.bss .bss.*)
|
||||||
|
@ -26,15 +26,15 @@ ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
|||||||
|
|
||||||
# Toolset data
|
# Toolset data
|
||||||
tools[ 'str9' ] = {}
|
tools[ 'str9' ] = {}
|
||||||
tools[ 'str9' ][ 'cccom' ] = "arm-elf-gcc -mcpu=arm966e-s -mfpu=fpa %s %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( opt, local_include, modeflag, cdefs )
|
tools[ 'str9' ][ 'cccom' ] = "%s -mcpu=arm966e-s -mfpu=fpa %s %s %s -ffunction-sections -fdata-sections %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile'], opt, local_include, modeflag, cdefs )
|
||||||
tools[ 'str9' ][ 'linkcom' ] = "arm-elf-gcc -mcpu=arm966e-s -mfpu=fpa -nostartfiles -nostdlib %s -T %s -Wl,--gc-sections -Wl,-e,_startup -Wl,--allow-multiple-definition -o $TARGET $SOURCES %s -lc -lgcc -lm" % ( modeflag, ldscript, local_libs )
|
tools[ 'str9' ][ 'linkcom' ] = "%s -mcpu=arm966e-s -mfpu=fpa -nostartfiles -nostdlib %s -T %s -Wl,--gc-sections -Wl,-e,_startup -Wl,--allow-multiple-definition -o $TARGET $SOURCES %s -lc -lgcc -lm" % ( toolset[ 'compile' ], modeflag, ldscript, local_libs )
|
||||||
tools[ 'str9' ][ 'ascom' ] = "arm-elf-gcc -x assembler-with-cpp %s -mcpu=arm966e-s -mfpu=fpa %s %s -Wall -c $SOURCE -o $TARGET" % ( local_include, modeflag, cdefs )
|
tools[ 'str9' ][ 'ascom' ] = "%s -x assembler-with-cpp %s -mcpu=arm966e-s -mfpu=fpa %s %s -Wall -c $SOURCE -o $TARGET" % ( toolset[ 'compile' ], local_include, modeflag, cdefs )
|
||||||
|
|
||||||
# Programming function for LPC2888
|
# Programming function for LPC2888
|
||||||
def progfunc_str9( target, source, env ):
|
def progfunc_str9( target, source, env ):
|
||||||
outname = output + ".elf"
|
outname = output + ".elf"
|
||||||
os.system( "arm-elf-size %s" % outname )
|
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||||
print "Generating binary image..."
|
print "Generating binary image..."
|
||||||
os.system( "arm-elf-objcopy -O binary %s %s.bin" % ( outname, output ) )
|
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||||
|
|
||||||
tools[ 'str9' ][ 'progfunc' ] = progfunc_str9
|
tools[ 'str9' ][ 'progfunc' ] = progfunc_str9
|
||||||
|
@ -25,6 +25,8 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_efixed = .;
|
_efixed = .;
|
||||||
PROVIDE(etext = .);
|
PROVIDE(etext = .);
|
||||||
|
_fini = .;
|
||||||
|
*(.fini)
|
||||||
} >flash
|
} >flash
|
||||||
|
|
||||||
.relocate : AT (_efixed)
|
.relocate : AT (_efixed)
|
||||||
@ -37,6 +39,18 @@ SECTIONS
|
|||||||
_erelocate = .;
|
_erelocate = .;
|
||||||
} >sram
|
} >sram
|
||||||
|
|
||||||
|
.ARM.extab :
|
||||||
|
{
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} >sram
|
||||||
|
|
||||||
|
__exidx_start = .;
|
||||||
|
.ARM.exidx :
|
||||||
|
{
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} >sram
|
||||||
|
__exidx_end = .;
|
||||||
|
|
||||||
.bss (NOLOAD) : {
|
.bss (NOLOAD) : {
|
||||||
_szero = .;
|
_szero = .;
|
||||||
*(.bss .bss.*)
|
*(.bss .bss.*)
|
||||||
|
@ -136,7 +136,7 @@ static void shell_recv( char* args )
|
|||||||
while( *p == '\x1A' )
|
while( *p == '\x1A' )
|
||||||
p --;
|
p --;
|
||||||
p ++;
|
p ++;
|
||||||
printf( "done, got %ld bytes\n", p - shell_prog );
|
printf( "done, got %u bytes\n", ( unsigned )( p - shell_prog ) );
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
if( ( L = lua_open() ) == NULL )
|
if( ( L = lua_open() ) == NULL )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user