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

Build and test cmake_gcc_arm #401

Closed
wants to merge 2 commits into from
Closed

Build and test cmake_gcc_arm #401

wants to merge 2 commits into from

Conversation

theotherjimmy
Copy link
Contributor

resolves #347

@@ -64,7 +64,7 @@ set(SOURCES_S ${SOURCES_S} "{{file}}"){% endfor %}
{% for file in source_files_obj %}
set(OBJECT_FILES ${OBJECT_FILES} "{{file}}"){% endfor %}

set(COMMON_FLAGS "-mcpu={{core}} {% for flag in misc['common_flags'] %} {{flag}}{% endfor %}")
set(COMMON_FLAGS "-mcpu={{core}} -mthumb {% for flag in misc['common_flags'] %} {{flag}}{% endfor %}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be in the common flags ? I would assume arm mode is possible, not only thumb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm matching the makefile template for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok we can fix that later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#402 opened to address that issue in the future.

@theotherjimmy
Copy link
Contributor Author

Uh, so it succeeded on pypi, which I was not expecting. I'm going to see if I can force the compiler to be what I want.

@theotherjimmy
Copy link
Contributor Author

I know this is a bit unorthodox, but after removing arm-none-eabi-gcc from my machine, all tests pass. I don't know how the CI is getting past line 31 of the CMakeList.txt

@0xc0170
Copy link
Member

0xc0170 commented Jun 21, 2016

I know this is a bit unorthodox, but after removing arm-none-eabi-gcc from my machine, all tests pass. I don't know how the CI is getting past line 31 of the CMakeList.txt

Strange, only one test group failes, travis says pypi , and it's because of build does not return -1, so it does not fail. reports no errors :/ any indications?

@theotherjimmy
Copy link
Contributor Author

Yeah, the pypi script finds gcc, when it should fail to find arm-none-eabi-gcc.

@0xc0170
Copy link
Member

0xc0170 commented Jun 29, 2016

What's the status of this PR, tests are still red

@theotherjimmy
Copy link
Contributor Author

I can't seem to force cmake with pypi on travis to bail when it does not find the right compiler. I can't reproduce the problem.

@0xc0170
Copy link
Member

0xc0170 commented Jun 29, 2016

I fetched this locally, run test_build test ,got 2 errors:

nosetests tests\test_commands\test_build.py
.-- Building for: NMake Makefiles
CMake Deprecation Warning at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeForceCompiler.cmake:73 (message):
  The CMAKE_FORCE_C_COMPILER macro is deprecated.  Instead just set
  CMAKE_C_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
  CMakeLists.txt:20 (cmake_force_c_compiler)


CMake Deprecation Warning at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeForceCompiler.cmake:87 (message):
  The CMAKE_FORCE_CXX_COMPILER macro is deprecated.  Instead just set
  CMAKE_CXX_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
  CMakeLists.txt:21 (cmake_force_cxx_compiler)


-- The ASM compiler identification is GNU
-- Found assembler: C:/Programs/gcc_arm_4.9_2015q3/bin/arm-none-eabi-gcc.exe
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Code/github/progen/project_generator_mbed_examples/tools/project_generator/generated_projects/cmake_gcc_arm_project_2
makefile:37: *** missing separator.  Stop.
.....mkdir build
Building file: main.o
Invoking: MCU C++ Compiler
armcc  -I.  -I..\..\test_workspace -c -DMACRO1  -DMACRO2   --cpu cortex-m3 --thumb  ..\..\test_workspace/main.cpp -o build/main.o
process_begin: CreateProcess(NULL, armcc -I. -I..\..\test_workspace -c -DMACRO1 -DMACRO2 --cpu cortex-m3 --thumb ..\..\test_workspace/main.cpp -o build/main.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [build/main.o] Error 2
.mkdir build
Building file: main.o
Invoking: MCU C++ Compiler
arm-none-eabi-g++  -I.  -I..\..\test_workspace -c -DMACRO1  -DMACRO2   -mcpu=cortex-m3 -mthumb -MMD -MP -DMACRO1  -DMACRO2    ..\..\test_workspace/main.cpp -o build/main.o
Finished building: main.o

Building target: build/project_2.elf
Invoking: MCU Linker
arm-none-eabi-gcc  -o build/project_2.elf build/main.o       -mcpu=cortex-m3 -mthumb -Wl,-Map=build/project_2.map,--cref -T..\..\test_workspace\linker.ld
Finished building target: build/project_2.elf

Printing size
arm-none-eabi-size --totals build/project_2.elf
   text    data     bss     dec     hex filename
    988    1088      40    2116     844 build/project_2.elf
    988    1088      40    2116     844 (TOTALS)
arm-none-eabi-objcopy -O ihex build/project_2.elf  build/project_2.hex
arm-none-eabi-objcopy -O binary -v build/project_2.elf  build/project_2.bin
copy from `build/project_2.elf' [elf32-littlearm] to `build/project_2.bin' [binary]
arm-none-eabi-objdump -D build/project_2.elf > build/project_2.lst
arm-none-eabi-nm build/project_2.elf > build/project_2-symbol-table.txt

true
Fmkdir build
Building file: main.o
Invoking: MCU C++ Compiler
arm-none-eabi-g++  -I.  -I..\..\test_workspace -c -DMACRO1  -DMACRO2   -mcpu=cortex-m3 -mthumb -MMD -MP -DMACRO1  -DMACRO2    ../../test_workspace/main.cpp -o build/main.o
Finished building: main.o

Building target: build/project_2.elf
Invoking: MCU Linker
arm-none-eabi-gcc  -o build/project_2.elf build/main.o       -mcpu=cortex-m3 -mthumb -Wl,-Map=build/project_2.map,--cref -T..\..\test_workspace\linker.ld
Finished building target: build/project_2.elf

Printing size
arm-none-eabi-size --totals build/project_2.elf
   text    data     bss     dec     hex filename
    988    1088      40    2116     844 build/project_2.elf
    988    1088      40    2116     844 (TOTALS)
arm-none-eabi-objcopy -O ihex build/project_2.elf  build/project_2.hex
arm-none-eabi-objcopy -O binary -v build/project_2.elf  build/project_2.bin
copy from `build/project_2.elf' [elf32-littlearm] to `build/project_2.bin' [binary]
arm-none-eabi-objdump -D build/project_2.elf > build/project_2.lst
arm-none-eabi-nm build/project_2.elf > build/project_2-symbol-table.txt

true
F...
======================================================================
FAIL: test_build_project_make_gcc_arm_tool (test_commands.test_build.TestBuildCommand)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Code\github\progen\project_generator_mbed_examples\tools\project_generator\tests\test_commands\test_build.py", line 99, in test_build_project_make_gcc_arm_tool
    assert result == -1
AssertionError:
-------------------- >> begin captured logging << --------------------
progen.project: DEBUG:
common:
  build_dir: build
  debugger: j-link
  export_dir: ''
  includes: &id001 [test_workspace/header1.h]
  linker_file: test_workspace/linker.ld
  macros: &id002 [MACRO1, MACRO2]
  misc: &id003 {}
  name: project_2
  output_type: exe
  sources: &id004 [test_workspace/main.cpp]
  target: mbed-lpc1768
  template: []
  tools_supported: &id005 []
merged:
  build_dir: build
  debugger: j-link
  export_dir: ''
  include_files:
    default: [..\..\test_workspace\header1.h]
  include_paths: [..\..\test_workspace]
  includes: *id001
  linker_file: ..\..\test_workspace\linker.ld
  macros: *id002
  misc: *id003
  name: project_2
  output_dir: {path: generated_projects\make_gcc_arm_project_2, rel_count: 2, rel_path: ..\..\}
  output_type: exe
  singular: true
  source_files_c: {}
  source_files_cpp:
    default: [..\..\test_workspace\main.cpp]
  source_files_lib: {}
  source_files_obj: {}
  source_files_s: {}
  source_paths: [..\..\test_workspace]
  sources: *id004
  target: mbed-lpc1768
  template: []
  tools_supported: *id005
tool_specific: {}

progen.tools: DEBUG: Generating: generated_projects\make_gcc_arm_project_2\Makefile
progen.project: DEBUG: Building for tool: make_gcc_arm
progen.project: DEBUG: {'make_gcc_arm': {'files': {'makefile': 'generated_projects\\make_gcc_arm_project_2\\Makefile'}, 'path': 'generated_projects\\make_gcc_arm_project_2'}}
root: DEBUG: Building GCC ARM project: generated_projects\make_gcc_arm_project_2
root: DEBUG: ['make', 'all']
root: INFO: Build succeeded with the status: no errors)
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test_build_project_sublime_tool (test_commands.test_build.TestBuildCommand)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Code\github\progen\project_generator_mbed_examples\tools\project_generator\tests\test_commands\test_build.py", line 145, in test_build_project_sublime_tool
    assert result == -1
AssertionError:
-------------------- >> begin captured logging << --------------------
progen.project: DEBUG:
common:
  build_dir: build
  debugger: j-link
  export_dir: ''
  includes: &id001 [test_workspace/header1.h]
  linker_file: test_workspace/linker.ld
  macros: &id002 [MACRO1, MACRO2]
  misc: &id003 {}
  name: project_2
  output_type: exe
  sources: &id004 [test_workspace/main.cpp]
  target: mbed-lpc1768
  template: []
  tools_supported: &id005 []
merged:
  build_dir: build
  debugger: j-link
  export_dir: ''
  include_files:
    default: [..\..\test_workspace\header1.h]
  include_paths: [..\..\test_workspace]
  includes: *id001
  linker_file: ..\..\test_workspace\linker.ld
  macros: *id002
  misc: *id003
  name: project_2
  output_dir: {path: generated_projects\sublime_make_gcc_arm_project_2, rel_count: 2,
    rel_path: ..\..\}
  output_type: exe
  singular: true
  source_files_c: {}
  source_files_cpp:
    default: [..\..\test_workspace\main.cpp]
  source_files_lib: {}
  source_files_obj: {}
  source_files_s: {}
  source_paths: [..\..\test_workspace]
  sources: *id004
  target: mbed-lpc1768
  template: []
  tools_supported: *id005
tool_specific: {}

progen.tools: DEBUG: Generating: generated_projects\sublime_make_gcc_arm_project_2\Makefile
progen.tools: DEBUG: Generating: generated_projects\sublime_make_gcc_arm_project_2\project_2.sublime-project

progen.project: DEBUG: Building for tool: sublime_make_gcc_arm
progen.project: DEBUG: {'sublime_make_gcc_arm': {'files': {'makefile': 'generated_projects\\sublime_make_gcc_arm_project_2\\Makefile', 'sublimetext': 'generated_projects\\sublime_make_gcc_arm_project_2\\project_2.sublime-project'}, 'path': 'generated_projects\\sublime_make_gcc_arm_project_2'}}
root: DEBUG: Building GCC ARM project: generated_projects\sublime_make_gcc_arm_project_2
root: DEBUG: ['make', 'all']
root: INFO: Build succeeded with the status: no errors)
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 12 tests in 4.648s

FAILED (failures=2)
cmake --version
cmake version 3.5.0-rc2

arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150529 (release)

@theotherjimmy
Copy link
Contributor Author

theotherjimmy commented Jun 29, 2016

That's not expected. You should be getting 3 failures.
My log:

.-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jimbri01/src/project_generator/project_generator/generated_projects/cmake_gcc_arm_project_2
Scanning dependencies of target project_2
[100%] Building CXX object CMakeFiles/project_2.dir/home/jimbri01/src/project_generator/project_generator/test_workspace/main.cpp.obj
Linking C executable build/project_2
[100%] Built target project_2
F....Building file: main.o
Invoking: MCU C++ Compiler
armcc  -I.  -I../../test_workspace -c -DMACRO1  -DMACRO2   --cpu cortex-m3 --thumb  ../../test_workspace/main.cpp -o build/main.o
Finished building: main.o

Building target: build/project_2.elf
Invoking: MCU Linker
armlink  -o build/project_2.elf build/main.o       --strict --scatter ../../test_workspace/linker.ld --predefine "-DMACRO1" --predefine "-DMACRO2" --predefine "-I." --predefine "-I../../test_workspace" 
"../../test_workspace/linker.ld", line 1 (column 1): Error: L6229E: Scatter description ../../test_workspace/linker.ld is empty.
Error: L6372E: Image needs at least one load region.
Finished: 0 information, 0 warning and 2 error messages.
make: *** [build/project_2.elf] Error 1
.Building file: main.o
Invoking: MCU C++ Compiler
arm-none-eabi-g++  -I.  -I../../test_workspace -c -DMACRO1  -DMACRO2   -mcpu=cortex-m3 -mthumb -MMD -MP -DMACRO1  -DMACRO2    ../../test_workspace/main.cpp -o build/main.o
Finished building: main.o

Building target: build/project_2.elf
Invoking: MCU Linker
arm-none-eabi-gcc  -o build/project_2.elf build/main.o       -mcpu=cortex-m3 -mthumb -Wl,-Map=build/project_2.map,--cref -T../../test_workspace/linker.ld 
Finished building target: build/project_2.elf

Printing size
arm-none-eabi-size --totals build/project_2.elf
   text    data     bss     dec     hex filename
    988    1088      40    2116     844 build/project_2.elf
    988    1088      40    2116     844 (TOTALS)
arm-none-eabi-objcopy -O ihex build/project_2.elf  build/project_2.hex
arm-none-eabi-objcopy -O binary -v build/project_2.elf  build/project_2.bin
copy from `build/project_2.elf' [elf32-littlearm] to `build/project_2.bin' [binary]
arm-none-eabi-objdump -D build/project_2.elf > build/project_2.lst
arm-none-eabi-nm build/project_2.elf > build/project_2-symbol-table.txt

true
FBuilding file: main.o
Invoking: MCU C++ Compiler
arm-none-eabi-g++  -I.  -I../../test_workspace -c -DMACRO1  -DMACRO2   -mcpu=cortex-m3 -mthumb -MMD -MP -DMACRO1  -DMACRO2    ../../test_workspace/main.cpp -o build/main.o
Finished building: main.o

Building target: build/project_2.elf
Invoking: MCU Linker
arm-none-eabi-gcc  -o build/project_2.elf build/main.o       -mcpu=cortex-m3 -mthumb -Wl,-Map=build/project_2.map,--cref -T../../test_workspace/linker.ld 
Finished building target: build/project_2.elf

Printing size
arm-none-eabi-size --totals build/project_2.elf
   text    data     bss     dec     hex filename
    988    1088      40    2116     844 build/project_2.elf
    988    1088      40    2116     844 (TOTALS)
arm-none-eabi-objcopy -O ihex build/project_2.elf  build/project_2.hex
arm-none-eabi-objcopy -O binary -v build/project_2.elf  build/project_2.bin
copy from `build/project_2.elf' [elf32-littlearm] to `build/project_2.bin' [binary]
arm-none-eabi-objdump -D build/project_2.elf > build/project_2.lst
arm-none-eabi-nm build/project_2.elf > build/project_2-symbol-table.txt

true
F...
======================================================================
FAIL: test_build_project_cmake_gcc_arm_tool (tests.test_commands.test_build.TestBuildCommand)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jimbri01/src/project_generator/project_generator/tests/test_commands/test_build.py", line 106, in test_build_project_cmake_gcc_arm_tool
    assert result == -1
AssertionError: 
-------------------- >> begin captured logging << --------------------
progen.project: DEBUG: 
common:
  build_dir: build
  debugger: j-link
  export_dir: ''
  includes: &id001 [test_workspace/header1.h]
  linker_file: test_workspace/linker.ld
  macros: &id002 [MACRO1, MACRO2]
  misc: &id003 {}
  name: project_2
  output_type: exe
  sources: &id004 [test_workspace/main.cpp]
  target: mbed-lpc1768
  template: []
  tools_supported: &id005 []
merged:
  build_dir: build
  debugger: j-link
  export_dir: ''
  include_files:
    default: [../../test_workspace/header1.h]
  include_paths: [../../test_workspace]
  includes: *id001
  linker_file: ../../test_workspace/linker.ld
  macros: *id002
  misc: *id003
  name: project_2
  output_dir: {path: generated_projects/cmake_gcc_arm_project_2, rel_count: 2, rel_path: ../../}
  output_type: exe
  singular: true
  source_files_c: {}
  source_files_cpp:
    default: [../../test_workspace/main.cpp]
  source_files_lib: {}
  source_files_obj: {}
  source_files_s: {}
  source_paths: [../../test_workspace]
  sources: *id004
  target: mbed-lpc1768
  template: []
  tools_supported: *id005
tool_specific: {}

progen.tools: DEBUG: Generating: generated_projects/cmake_gcc_arm_project_2/CMakeLists.txt
progen.project: DEBUG: Building for tool: cmake_gcc_arm
progen.project: DEBUG: {'cmake_gcc_arm': {'files': {'cmakelist': 'generated_projects/cmake_gcc_arm_project_2/CMakeLists.txt'}, 'path': 'generated_projects/cmake_gcc_arm_project_2'}}
root: DEBUG: Building GCC ARM project: generated_projects/cmake_gcc_arm_project_2
root: DEBUG: ['cmake', '.']
root: INFO: CMake succeeded with the status: no errors)
root: DEBUG: ['make', 'all']
root: INFO: Build succeeded with the status: no errors)
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test_build_project_make_gcc_arm_tool (tests.test_commands.test_build.TestBuildCommand)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jimbri01/src/project_generator/project_generator/tests/test_commands/test_build.py", line 99, in test_build_project_make_gcc_arm_tool
    assert result == -1
AssertionError: 
-------------------- >> begin captured logging << --------------------
progen.project: DEBUG: 
common:
  build_dir: build
  debugger: j-link
  export_dir: ''
  includes: &id001 [test_workspace/header1.h]
  linker_file: test_workspace/linker.ld
  macros: &id002 [MACRO1, MACRO2]
  misc: &id003 {}
  name: project_2
  output_type: exe
  sources: &id004 [test_workspace/main.cpp]
  target: mbed-lpc1768
  template: []
  tools_supported: &id005 []
merged:
  build_dir: build
  debugger: j-link
  export_dir: ''
  include_files:
    default: [../../test_workspace/header1.h]
  include_paths: [../../test_workspace]
  includes: *id001
  linker_file: ../../test_workspace/linker.ld
  macros: *id002
  misc: *id003
  name: project_2
  output_dir: {path: generated_projects/make_gcc_arm_project_2, rel_count: 2, rel_path: ../../}
  output_type: exe
  singular: true
  source_files_c: {}
  source_files_cpp:
    default: [../../test_workspace/main.cpp]
  source_files_lib: {}
  source_files_obj: {}
  source_files_s: {}
  source_paths: [../../test_workspace]
  sources: *id004
  target: mbed-lpc1768
  template: []
  tools_supported: *id005
tool_specific: {}

progen.tools: DEBUG: Generating: generated_projects/make_gcc_arm_project_2/Makefile
progen.project: DEBUG: Building for tool: make_gcc_arm
progen.project: DEBUG: {'make_gcc_arm': {'files': {'makefile': 'generated_projects/make_gcc_arm_project_2/Makefile'}, 'path': 'generated_projects/make_gcc_arm_project_2'}}
root: DEBUG: Building GCC ARM project: generated_projects/make_gcc_arm_project_2
root: DEBUG: ['make', 'all']
root: INFO: Build succeeded with the status: no errors)
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test_build_project_sublime_tool (tests.test_commands.test_build.TestBuildCommand)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jimbri01/src/project_generator/project_generator/tests/test_commands/test_build.py", line 145, in test_build_project_sublime_tool
    assert result == -1
AssertionError: 
-------------------- >> begin captured logging << --------------------
progen.project: DEBUG: 
common:
  build_dir: build
  debugger: j-link
  export_dir: ''
  includes: &id001 [test_workspace/header1.h]
  linker_file: test_workspace/linker.ld
  macros: &id002 [MACRO1, MACRO2]
  misc: &id003 {}
  name: project_2
  output_type: exe
  sources: &id004 [test_workspace/main.cpp]
  target: mbed-lpc1768
  template: []
  tools_supported: &id005 []
merged:
  build_dir: build
  debugger: j-link
  export_dir: ''
  include_files:
    default: [../../test_workspace/header1.h]
  include_paths: [../../test_workspace]
  includes: *id001
  linker_file: ../../test_workspace/linker.ld
  macros: *id002
  misc: *id003
  name: project_2
  output_dir: {path: generated_projects/sublime_make_gcc_arm_project_2, rel_count: 2,
    rel_path: ../../}
  output_type: exe
  singular: true
  source_files_c: {}
  source_files_cpp:
    default: [../../test_workspace/main.cpp]
  source_files_lib: {}
  source_files_obj: {}
  source_files_s: {}
  source_paths: [../../test_workspace]
  sources: *id004
  target: mbed-lpc1768
  template: []
  tools_supported: *id005
tool_specific: {}

progen.tools: DEBUG: Generating: generated_projects/sublime_make_gcc_arm_project_2/Makefile
progen.tools: DEBUG: Generating: generated_projects/sublime_make_gcc_arm_project_2/project_2.sublime-project
progen.project: DEBUG: Building for tool: sublime_make_gcc_arm
progen.project: DEBUG: {'sublime_make_gcc_arm': {'files': {'makefile': 'generated_projects/sublime_make_gcc_arm_project_2/Makefile', 'sublimetext': 'generated_projects/sublime_make_gcc_arm_project_2/project_2.sublime-project'}, 'path': 'generated_projects/sublime_make_gcc_arm_project_2'}}
root: DEBUG: Building GCC ARM project: generated_projects/sublime_make_gcc_arm_project_2
root: DEBUG: ['make', 'all']
root: INFO: Build succeeded with the status: no errors)
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 12 tests in 0.830s

versions:

$ cmake --version
cmake version 2.8.12.2
$ make --version
GNU Make 3.81
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 227977]

@theotherjimmy
Copy link
Contributor Author

Our versions of cmake are very different.

@theotherjimmy
Copy link
Contributor Author

I don't have time to update this PR, so I'm going to close it. If you would like to start where I left off, you are welcome to use the cmake-bulid branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cmake - build support
2 participants