IAR / CMake / Build Machine - Page 1
Forum section: electronics / general

author: shangaoren
author_rank: Regular Contributor
timestamp: September 14, 2023, 12:12:58 pm
content: Hello,I'm working for a client on a project using IAR Embedded Workbench, which is .... archaic, i used VS Code for developmentRecently i bought a MBP as day to day computer, and for confort i would like to use CLion for dev, as IAR is only on windows does someone know if it is possible to setup a computer as a builder and use it from the Mac (or other machine) ?

author: radiolistener
author_rank: Super Contributor
timestamp: September 14, 2023, 07:03:54 pm
content: you can use gcc to build project, but there are some pitfalls, since gcc optimizer is not so smart, the result code may not fit into memory. And I'm afraid that your client will not like your idea to use other environment for development. Just because you never know how it will be compiled and work with original environment.Also there is IAR Build Tools for Linux.If your client want firmware for IAR, you're needs to develop and debug it on IAR...After all, you can install windoze on your MacBook Pro...

author: shangaoren
author_rank: Regular Contributor
timestamp: September 14, 2023, 08:15:11 pm
content: I already tried to use GCC but building that way exceed system flash size.I must admit that i wanted to share IAR build machine to be able to build fron CI too but i think my client does not have the budget to buy IAR Build tool for linux :/

author: eutectique
author_rank: Frequent Contributor
timestamp: September 14, 2023, 09:14:38 pm
content: Quote from: shangaoren on September 14, 2023, 08:15:11 pmExceeds by how much?Is it a C++ project?What GCC version did you use?Do you haveassert()in the code? You might see all the file names with full paths in the binary.What about-Oscompiler option? Did you specify right architecture? Does your MCU has FPU, and if yes, what floating-point ABI you used for compilation?IAR compiler must do miracles, if its generated code fits the flash, and GCC's does not.You could share the source code from your Linux (or Mac, for that matter) via Samba server, do development there, and dispatch compilation on Windose withsshfor example. Opportunities are plenty.

author: radiolistener
author_rank: Super Contributor
timestamp: September 15, 2023, 06:25:19 am
content: Quote from: eutectique on September 14, 2023, 09:14:38 pmYes, it do. As I remember it produces about 30% smaller code than gcc and that smaller code works about 10-20% faster than code produced with gcc. Even if you use speed optimizations for iar and size optimizations for gcc, iar still produces much smaller size of code... I got that result for C code. I compared for loop from my code and found that iar code generator is much more smart than gcc. This is classic issue, when you're trying to compile code on gcc and it doesn't fit into memory, while on iar it fits and have a lot of free space... Sometimes it produce twice smaller code than gcc and it works much faster than gcc code even if you use size optimizations for iar and speed optimizations for gcc.

author: shangaoren
author_rank: Regular Contributor
timestamp: September 15, 2023, 07:38:02 am
content: i can't remember how much it exceed, i tested this some years ago,i tested it this the latest version of stm32cubeide at the time using -Os and maybe LTO but btu even if it fits the code heavily use some specific fonction of IAR and it would take time to modify.it's a C project (another problem to solve from my point of view xD ) no FPU, no assert()IAR is (sadly) known to have a more efficient compiler and more optimized library for arm, just by seeing their tools you know that's not for this people are paying for ....

author: bingo600
author_rank: Super Contributor
timestamp: September 15, 2023, 08:26:26 am
content: If i seek for something like :Windows execute program from remote linuxi see some hits.Might be a bit of a "kludge" , but if you setup a Windows share , and put sources etc there.You might be able to access that from the MAC.And then use some "Remote execution magic" to kick off a "make w. the iar compiler" on the Win PC.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: September 15, 2023, 01:46:32 pm
content: Take a look at the GitHub runners. Windows is there.https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runnersYou can have a beatiful CI

author: abyrvalg
author_rank: Frequent Contributor
timestamp: September 15, 2023, 02:24:42 pm
content: IMO, IAR's superiority over GCC is a myth based on outdated comparisons vs ST's bundled GCC 4.x and improper settings. A fresh GCC (v9+) from ARM web site configured to-Os -flto -ffunction-sections -fdata-sections -Wl,--gc-sectionsis on par with IAR's "optimize for size"+"single file mode". Enabling LTO is critical for GCC to achieve small size (and, perhaps, getting rid of blasphemous ST's asm startup files declaring tons of WEAK symbols, they are suspected for hindering the LTO).One special case where IAR still can beat GCC seriously is data section compression feature (GCC doesn't have it). A 1000-byte global/static array initialized to 999 zeroes and a single 1 would occupy 1000 bytes with GCC and just few bytes with IAR (due to compression). We've coded an ELF post-processor and a custom startup to do the same with GCC.Can't say much about bundled libraries, haven't seen anything bigger that memcpy/memset pulled from the lib, and those are ok from both.Sorry for little derailing.

author: eutectique
author_rank: Frequent Contributor
timestamp: September 15, 2023, 04:35:32 pm
content: Data section compression -- yes, but on expense of flash for decompressor code.Also, GCC is not the only free tool available, there is LLVM.