10 years, 6 months ago.

Tutrial build error.

Please sea following my PC result.

kazu@kazu-deverop:~/mbedtools$ build.py -v -m LPC1768 -t GCC_CS

>>> BUILD LIBRARY CMSIS (LPC1768, GCC_CS)
Compile: sys.cpp
/home/kazu/armsoucery/bin/arm-none-eabi-g++ -std=gnu++98 -c -O2 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -MMD -fno-delete-null-pointer-checks -mcpu=cortex-m3 -mthumb -DTARGET_LPC1768 -DTARGET_M3 -DTARGET_NXP -DTARGET_LPC176X -DTARGET_MBED_LPC1768 -DTOOLCHAIN_GCC_CS -DTOOLCHAIN_GCC -D__CORTEX_M3 -DARM_MATH_CM3 -DMBED_BUILD_TIMESTAMP=1401823156.26 -D__MBED__=1 -DMBED_USERNAME=kazu_zamasu -I/home/kazu/mbedtools/libraries/mbed/targets/cmsis -I/home/kazu/mbedtools/libraries/mbed/targets/cmsis/TARGET_NXP -I/home/kazu/mbedtools/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X -I/home/kazu/mbedtools/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS -o /home/kazu/mbedtools/build/mbed/.temp/TARGET_LPC1768/TOOLCHAIN_GCC_CS/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/sys.o /home/kazu/mbedtools/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/sys.cpp
Traceback (most recent call last):
  File "/home/kazu/mbedtools/workspace_tools/build.py", line 104, in <module>
    macros=options.macros)
  File "/home/kazu/mbedtools/workspace_tools/build_api.py", line 165, in build_mbed_libs
    objects = toolchain.compile_sources(resources, TMP_PATH)
  File "/home/kazu/mbedtools/workspace_tools/toolchains/__init__.py", line 398, in compile_sources
    self.compile_cpp(source, object, inc_paths)
  File "/home/kazu/mbedtools/workspace_tools/toolchains/__init__.py", line 436, in compile_cpp
    self.compile(self.cppc, source, object, includes)
  File "/home/kazu/mbedtools/workspace_tools/toolchains/__init__.py", line 430, in compile
    raise ToolException(stderr)
ToolException: /home/kazu/mbedtools/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/sys.cpp:22:29: error: 'NULL' was not declared in this scope
 static void *heap_pointer = NULL;
                             ^
/home/kazu/mbedtools/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/sys.cpp: In function 'void* _sbrk(unsigned int)':
/home/kazu/mbedtools/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/sys.cpp:71:15: error: 'NULL' was not declared in this scope
         mem = NULL;
               ^

kazu@kazu-deverop:~/mbedtools$ /home/kazu/armsoucery/bin/arm-none-eabi-g++ --version
arm-none-eabi-g++ (Sourcery CodeBench Lite 2013.11-33) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I think maybe this compile error from compiler version. Please let me know recommend or require Sourcery CodeBench compiler version.

Question relating to:

1 Answer

10 years, 6 months ago.

Hello,

I am using 4.7.3 version, and did not experience this issue, can you try that one and report back?

Regards,
0xc0170

Accepted Answer

Hello Martin, I find this issue point. mbed-SDK python script, call to "arm-none-eabi-foo", but Sourcery CodeBench name is arm-none-linux-gnueabi-foo or arm-none-linux-gnueabi/bin/gcc. Therefore, I make to hard link. ln -sf arm-none-linux-gnueabi-foo arm-none-eabi-foo Build.py is call of only arm-none-eabi-foo. not arm-none-linux-gnueabi-foo.

please see following. workspace_tools/toolchains/gcc.py

        main_cc = join(tool_path, "arm-none-eabi-gcc")
        main_cppc = join(tool_path, "arm-none-eabi-g++")
        self.asm = [main_cc, "-x", "assembler-with-cpp"] + common_flags
        if not "analyze" in self.options:
            self.cc  = [main_cc, "-std=gnu99"] + common_flags
            self.cppc =[main_cppc, "-std=gnu++98"] + common_flags
        else:
            self.cc  = [join(GOANNA_PATH, "goannacc"), "--with-cc=" + main_cc.replace('\\', '/'), "-std=gnu99", "--dialect=gnu", '--output-format="%s"' % self.GOANNA_FORMAT] + common_flags
            self.cppc= [join(GOANNA_PATH, "goannac++"), "--with-cxx=" + main_cppc.replace('\\', '/'), "-std=gnu++98", "--dialect=gnu", '--output-format="%s"' % self.GOANNA_FORMAT] + common_flags
        
        self.ld = [join(tool_path, "arm-none-eabi-gcc"), "-Wl,--gc-sections", "-Wl,--wrap,main"] + self.cpu
        self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"]
        
        self.ar = join(tool_path, "arm-none-eabi-ar")
        self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")

class GCC_CS(GCC):
    def __init__(self, target, options=None, notify=None, macros=None):
        GCC.__init__(self, target, options, notify, macros, GCC_CS_PATH)

Thank you for your pick-up and answer for my question. Regards, Kazu,

posted by Kazu Zamasu 04 Jun 2014