From 1546274d899b5970edc674fa1767bd8403b0b417 Mon Sep 17 00:00:00 2001 From: geniusgogo Date: Thu, 3 Jul 2014 22:08:29 +0800 Subject: [PATCH] fixed bsp/frdm-k64f gcc compile --- bsp/frdm-k64f/K64FN1M0xxx12.ld | 17 +++++++++++++++-- bsp/frdm-k64f/device/SConscript | 6 +++--- .../device/TOOLCHAIN_GCC_ARM/startup_MK64F12.S | 4 +++- bsp/frdm-k64f/rtconfig.py | 10 +++++----- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/bsp/frdm-k64f/K64FN1M0xxx12.ld b/bsp/frdm-k64f/K64FN1M0xxx12.ld index 5bf14b145e..91516c7446 100644 --- a/bsp/frdm-k64f/K64FN1M0xxx12.ld +++ b/bsp/frdm-k64f/K64FN1M0xxx12.ld @@ -77,6 +77,19 @@ SECTIONS *(.dtors) *(.rodata*) +/* section information for finsh shell */ + . = ALIGN(4); + __fsymtab_start = .; + KEEP(*(FSymTab)) + __fsymtab_end = .; + . = ALIGN(4); + __vsymtab_start = .; + KEEP(*(VSymTab)) + __vsymtab_end = .; + . = ALIGN(4); + + . = ALIGN(4); + _etext = .; KEEP(*(.eh_frame*)) } > FLASH @@ -127,7 +140,7 @@ SECTIONS __data_end__ = .; } > RAM - + __bss_start = .; .bss : { __bss_start__ = .; @@ -135,7 +148,7 @@ SECTIONS *(COMMON) __bss_end__ = .; } > RAM - + __bss_end = .; .heap : { __end__ = .; diff --git a/bsp/frdm-k64f/device/SConscript b/bsp/frdm-k64f/device/SConscript index e196b1595a..b56031b5cf 100644 --- a/bsp/frdm-k64f/device/SConscript +++ b/bsp/frdm-k64f/device/SConscript @@ -5,18 +5,18 @@ from building import * # get current directory cwd = GetCurrentDir() - +path = [cwd, cwd + '/MK64F12'] src = Glob('MK64F12/*.c') #add for startup script if rtconfig.CROSS_TOOL == 'gcc': src = src + ['TOOLCHAIN_GCC_ARM/startup_MK64F12.S'] + src = src + ['TOOLCHAIN_GCC_ARM/startup.c'] + path += [cwd + 'TOOLCHAIN_GCC_ARM'] elif rtconfig.CROSS_TOOL == 'keil': src = src + ['TOOLCHAIN_ARM_STD/startup_MK64F12.s'] # elif rtconfig.CROSS_TOOL == 'iar': -path = [cwd, cwd + '/MK64F12'] - #CPPDEFINES = [''] group = DefineGroup('Device', src, depend = [''], CPPPATH = path) #CPPDEFINES = CPPDEFINES) diff --git a/bsp/frdm-k64f/device/TOOLCHAIN_GCC_ARM/startup_MK64F12.S b/bsp/frdm-k64f/device/TOOLCHAIN_GCC_ARM/startup_MK64F12.S index 5978e7c444..3b2fe5d214 100644 --- a/bsp/frdm-k64f/device/TOOLCHAIN_GCC_ARM/startup_MK64F12.S +++ b/bsp/frdm-k64f/device/TOOLCHAIN_GCC_ARM/startup_MK64F12.S @@ -229,7 +229,9 @@ disable_watchdog: ldr r0, =SystemInit blx r0 - ldr r0, =_start + ldr r0, =init_data_bss + blx r0 + ldr r0, =main bx r0 .pool .size Reset_Handler, . - Reset_Handler diff --git a/bsp/frdm-k64f/rtconfig.py b/bsp/frdm-k64f/rtconfig.py index 408432b6ad..a40c66dcf2 100644 --- a/bsp/frdm-k64f/rtconfig.py +++ b/bsp/frdm-k64f/rtconfig.py @@ -12,10 +12,10 @@ if os.getenv('RTT_CC'): # EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' - EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin' + EXEC_PATH = r'C:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin' elif CROSS_TOOL == 'keil': PLATFORM = 'armcc' - EXEC_PATH = 'C:/Keil' + EXEC_PATH = r'C:/Keil' elif CROSS_TOOL == 'iar': print '================ERROR============================' print 'Not support iar yet!' @@ -40,9 +40,9 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -g -Wall ' - AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' - LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -Wl,--gc-sections,-Map=rtthread-k64f.map,-cref,-u,Reset_Handler -T K64FN1M0xxx12.ld' + CFLAGS = DEVICE + ' -g -Wall -D__ASSEMBLY__ -D__FPU_USED' + AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' + LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread-k64f.map,-cref,-u,Reset_Handler -T K64FN1M0xxx12.ld' CPATH = '' LPATH = ''