iar 6.40 arm (stm32 ) Project file

416 views
Skip to first unread message

ozgunk...@gmail.com

unread,
Jan 15, 2013, 10:23:01 AM1/15/13
to throwth...@googlegroups.com
Spent a few hours trying to get ceedling work with IAR (ARM).

project.yml is listed below, so no one else has to. 

update the :path: and chose the correct  .icf  and .ddf file and should be ok. 

PS: Existing ceedling gem has a limitation on :executable: (No spaces allowed), that's why the tool chain bin folder is appended to the path environmental variable at start of the .yml file. 


---

# Notes:
# Sample project C code is not presently written to produce a release artifact.
# As such, release build options are disabled.
# This sample, therefore, only demonstrates running a collection of unit tests.

tools_root:
  &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.4\'

:environment:
  - :path:
    - C:/Program Files (x86)/IAR Systems/Embedded Workbench 6.4/arm/bin/
    - C:/Program Files (x86)/IAR Systems/Embedded Workbench 6.4/common/bin/    
    - C:/mingw/bin/    
    - "#{ENV['PATH']}"
          


:project:
  :use_exceptions: FALSE
  :use_test_preprocessor: TRUE
  :use_auxiliary_dependencies: TRUE
  :build_root: build
  # :release_build: TRUE
  :test_file_prefix: Test

#:release_build:
#  :output: TempSensor.out
#  :use_assembly: FALSE



:extension:
  :executable: .out

:paths:
  :test:
    - +:test/**
    - -:test/support
  :source:
    - src/**
  :support:
    - test/support

:defines:
  :common: &common_defines []
  :test:
    - *common_defines
    - TEST
  :test_preprocess:
    - *common_defines
    - TEST

:cmock:
  :when_no_prototypes: :warn
  :enforce_strict_ordering: TRUE
  :plugins:
    - :ignore
  :treat_as:
    uint8:    HEX8
    uint16:   HEX16
    uint32:   UINT32
    int8:     INT8
    bool:     UINT8

#:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use

:tools:
  :test_compiler:
    :executable:
      iccarm.exe
    :name: 'IAR Compiler'
    :arguments:
      - ${1} #source code input file (Ruby method call param list sub)
      - -o ./${2} #object file output (Ruby method call param list sub)  
      - -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR 
      - -I*tools_root"/arm/inc/"
      - -I*tools_root"/arm/inc/c"         
      - -D $: COLLECTION_DEFINES_TEST_AND_VENDOR
      - -DIAR
      - -DUNITY_SUPPORT_64
      - -DUNITY_SUPPORT_TEST_CASES      
      - --dlib_config
      - 'DLib_Config_Normal.h'
      - --no_cse
      - --no_unroll
      - --no_inline
      - --no_code_motion
      - --no_tbaa
      - --no_clustering
      - --no_scheduling 
      - --debug
      - --cpu_mode thumb
      - --endian=little
      - --cpu=Cortex-M3
      - --interwork
      - --warnings_are_errors
      - --fpu=None
      - --diag_suppress=Pa050
      - --diag_suppress=Pe111
      - -e
      - -On      
      #- “{`args.exe -m acme.prj`}” #in-line ruby sub to shell out & build string of arguments
    

  :test_linker:
    :executable: ilinkarm
    :name: 'IAR Linker'
    :arguments:
      - ${1} #list of object files to link (Ruby method call param list sub)
      #- -l$-lib: #inline yaml array substitution to link in foo-lib and bar-lib
      # - foo
      # - bar
      - -o ${2} #executable file output (Ruby method call param list sub)
      - --config src/stm32f4xx_flash.icf 
      - --no_wrap_diagnostics 
      - --entry __iar_program_start 
      - --vfe 
      - --semihosting 
      - --redirect _Printf=_PrintfFull 
      - --redirect _Scanf=_ScanfFull


  :test_fixture:
    :executable:
      "CSpyBat.exe"
    :name:
      'IAR cspy'
    :stderr_redirect: :win #inform Ceedling what model of $stderr capture to use
    :arguments:
      - --silent "armproc.dll" "armsim2.dll"     
      - --plugin "armbat.dll"
      - "${1}"      
      - --backend 
      - -B
      - -p *tools_root"/arm/config/debugger/ST/iostm32f4xxx.ddf" 
      - --cpu=Cortex-M3 
      - -d sim
      - 2>&1


:plugins:
  :load_paths:
    - vendor/ceedling/plugins
  :enabled:
    - stdout_pretty_tests_report
    #- stdout_ide_tests_report
...

Greg Williams

unread,
Jan 16, 2013, 1:52:58 PM1/16/13
to throwth...@googlegroups.com
Thanks a ton for the project.yml @ozgunkaragil!

IAR Embedded Workbench was one of the first toolchains we integrated Ceedling with. The nice thing too is that the command-line support for the compiler, linker, and simulator are pretty standard across different processor families. Therefore, adaptation to IAR EW for different processors is pretty trivial.

The best thing I have like about IAR is the fact that they DO have a command-line interface to the simulator, which is why we picked it for PICC18F development over the free/cheap MPLab supplied by MicroChip.

Don't get me wrong... cross-compiling and running your tests under GCC on your host system is definitely much better than nothing, and unfortunately the only viable option in many cases, but being able have the full automated test suite run against a real processor simulator for the target platform is the best option, even if it is only done in CI.

Thanks again!
Greg


--
You received this message because you are subscribed to the Google Groups "ThrowTheSwitch Science Forums" group.
To post to this group, send email to throwth...@googlegroups.com.
To unsubscribe from this group, send email to throwtheswitc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/throwtheswitch/-/VjaKof91ZYgJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

michae...@gmail.com

unread,
May 2, 2014, 11:09:44 AM5/2/14
to throwth...@googlegroups.com
This is great. I was working on an ARM project with IAR a few years ago, and used Unity to write tests. Ceedling wasn't available yet. This will be helpful for the next time

This brings up a question: Is there a single repository of project.yml files for the major development environments? It seems this would be a valuable resource to get people up and running much quicker.

I myself am trying to get the project.yml file to work on a new project now for a different tool chain and am banging my head on some settings, getting it to work.

Having an easy to find library of example project.yml files for multiple chipsets and toolchains would be very helpful

Thanks
Michael

Robert

unread,
May 6, 2014, 10:11:21 PM5/6/14
to throwth...@googlegroups.com, ozgunk...@gmail.com
Hi:

Thanks for your post of configuring the yaml to work with the IAR toolchain. I pretty much got everything working except when trying to 'dereference' the following line (or shortcut) later in the yml file for shortening some of the IAR toolchain paths:


tools_root:
  &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.4\'

I'm finding that the references to *tools_root do not seem to get interpreted or expanded later on the in the project file e.g. - -I*tools_root"/arm/inc/". If I look at what is passed to the compiler, I just see the same line. This method of creating shortcuts did work for me in a yml file when using just plain Unity.

One alternative that I tried that partially works is to do the following:

:environment:
  - :path:
    - C:/Program Files (x86)/IAR Systems/Embedded Workbench 6.5/arm/bin/
    - C:/Program Files (x86)/IAR Systems/Embedded Workbench 6.5/common/bin/   
  - :tools_path: 'C:/Program Files (x86)/IAR Systems/Embedded Workbench 6.5/'

And then later on I can use the 'tools_path' environment as such

:paths:
  :test_toolchain_include:
    - "#{ENV['TOOLS_PATH']}arm/inc"
    - "#{ENV['TOOLS_PATH']}arm/inc/c"
    - "#{ENV['TOOLS_PATH']}arm/inc/analogdevices"
    - "#{ENV['TOOLS_PATH']}arm/CMSIS/Include"

However, I still can't use the above environment variable substitution in my compiler/linker/simulator sections of the project file.

Anyone have any idea why either methods don't work or have an alternate solution?

Thanks
Robert

ozgunk...@gmail.com

unread,
May 9, 2014, 8:03:32 AM5/9/14
to throwth...@googlegroups.com, ozgunk...@gmail.com
Hello, 

I remember having the same problem: 
    environment variable substitution in my compiler/linker/simulator sections of the project file.

Looking at my .yml file it seems the trick was to add an '\' before "

eg: 

  :test_fixture:
    :executable:
      "CSpyBat.exe"
    :name:
      'IAR cspy'
    :stderr_redirect: :win #inform Ceedling what model of $stderr capture to use
    :arguments:
      - --silent "armproc.dll" "armsim2.dll"
      - --plugin "armbat.dll"
      - --code_coverage_file=${1}.coverage
          .....
      - -p \"#{ENV['TOOL_ROOT']}/arm/config/debugger/ST/STM32F417IG.ddf\"

 
Hope it helps, 
best regards,
 
Reply all
Reply to author
Forward
0 new messages