Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Neoman on June 27, 2008, 01:54:05 pm

Title: Parsing of IAR Build Output
Post by: Neoman on June 27, 2008, 01:54:05 pm
Hallo,

output of IAR Compiler looks like:

D:\work\Project\TTS_O\quellcode\tts_o\myFile.h(37) : Error[Pe040]: expected an identifier

How to set the regular expression to parse the outputs of IAR Compiler ?
Where to find the description how to customize the regular expression ?

(Settings/Compiler and debugger/other settings/advanced options/output parsing)

Best regards

Neoman
Title: Re: Parsing of IAR Build Output
Post by: Neoman on July 01, 2008, 12:10:18 pm
Please Help,

does exists a syntax documentation for the output parsing ?

Best Regards

Neoman
Title: Re: Parsing of IAR Build Output
Post by: killerbot on July 01, 2008, 03:01:21 pm
have a look at the syntax of the out of the box compilers. Or google around on regular expressions : I am sure you will find the solution then.
Title: Re: Parsing of IAR Build Output
Post by: Neoman on July 02, 2008, 07:56:01 am
Thanks for replay,

the output syntax of my compiler is clear for me. This is not the problem.
I'm looking for syntax of code::blocks output parser to parse for errors, warning etc.

How to interpret this expression ?

([][{}() \t#%$~A-Za-z0-9_:+/\.-]+):([0-9]+):[0-9]+:[ \t](.*)

How to change it for my compiler ?

Thanks for help

Neoman
Title: Re: Parsing of IAR Build Output
Post by: Jenna on July 02, 2008, 08:49:26 am
As killerbot says these are regular expressions and there are tons of documentation all over the web.
You can try this one with your error-output:
Code
([][{} \t#%$~A-Za-z0-9_:+/\.-\\]+)\(([0-9]+)\) : (.*)
with type set to "Error" and "Subexpression indices" set to:

If you test your message you get the following output:
Code
Regular expression analyzed as follows:

Type: Error message
Filename: D:/work/Project/TTS_O/quellcode/tts_o/myFile.h
Line number: 37
Message: Error[Pe040]: expected an identifier
Title: Re: Parsing of IAR Build Output
Post by: Neoman on July 02, 2008, 09:27:14 am
Thanks,

my mistake was the meaning of "regular expression".
You are right, there are a lot of sites about "regular expressions".

I tried your settings, but the Test results are not the same as yours :-( 
(see attached snapshot)

Regards,

Neoman

[attachment deleted by admin]
Title: Re: Parsing of IAR Build Output
Post by: Jenna on July 02, 2008, 11:34:08 am
Did you "play" with some of the regexes above the line you changed ("Linker error") ?

The first line that matches the regex is taken to create output.
Title: Re: Parsing of IAR Build Output
Post by: Neoman on July 02, 2008, 02:16:33 pm
You are right,

now i places a parsing expression "Test" on the first position in the list.
Testing expression works fine, but the output parsing can't catch the errors :-(

For example:

....
D:\work\MOD3000\DLL_N\quellcode\dll_n\dll_n.c(3272) : Error[Pe020]: identifier "dfgdfg" is undefined
....
Total number of errors: 2
Total number of warnings: 1

Process terminated with status 1 (0 minutes, 5 seconds)
0 errors, 0 warnings


Thanks for Your patience

Neoman

[attachment deleted by admin]
Title: Re: Parsing of IAR Build Output
Post by: Alatar on April 27, 2018, 11:19:53 am
Hello,

I currently use CB (r11367) with IAR EW ARM 7.3 to build my project and I noticed that even there is IAR support in CB, the message parsing is broken for me.
Seems like the output format was changed.
Here is actual example of the output:

Code
      bla;
      ^
"C:\_DATA_\project\main.c",83  Error[Pe020]: identifier "bla" is undefined
Errors: 1

I was able to get it work by modifying regexps as follows:
Code
-- ([][{}() \t#%$~[:alnum:]&_:+/\\.-]+),([0-9]+)[ \t]+([Ee]rror\\[[0-9A-Za-z]*\\]:.*)
++ "?([][{}() \t#%$~[:alnum:]&_:+/\.-]+)"?,([0-9]+)[ \t]+([Ee]rror\[[0-9A-Za-z]*\]:.*)

Find attached IAR-related part of CB config, that works for me. I did not test all the regexps in parser but for most common messages they are ok.
Title: Re: Parsing of IAR Build Output
Post by: oBFusCATed on April 27, 2018, 08:56:54 pm
Can you post a patch against the svn repo?
The compiler configurations are stored in xml files.
Title: Re: Parsing of IAR Build Output
Post by: Alatar on May 11, 2018, 06:13:07 am
Yes, sure. Here is it.
BTW there are another several things to do to be able to use IAR for ARM CortexM development out of the box:
* remove toolchain directory from linker path list by default
* add assembler compiler

For second point currently I use workaround with redefinition of resources compiler but I think it would be good idea to add separated toolchain executable for assembler compiler.
Title: Re: Parsing of IAR Build Output
Post by: oBFusCATed on October 18, 2020, 12:54:18 am
Patch applied sorry for the delay.

* remove toolchain directory from linker path list by default
What do you mean by this?

* add assembler compiler
This would be hard. Might be useful, but not too much. The build system of C::B is probably easily overwhelmed by the the requirements of embedded projects.
Title: Re: Parsing of IAR Build Output
Post by: Alatar on October 19, 2020, 08:59:20 pm
Thank you =)

* remove toolchain directory from linker path list by default
What do you mean by this?

Well that was some time ago, not sure I remember what it was exactly, but guess there were some problems with default value for "Compiler Settings -> Search directories -> Linker"
Can't test since I don't work with IAR anymore.

* add assembler compiler
This would be hard. Might be useful, but not too much. The build system of C::B is probably easily overwhelmed by the the requirements of embedded projects.

In embedded world it is common case where you mix C and ASM in one project. I'm fine with using "Advanced compiler option -> Commands" to compile non-c files but I don't want to hardcode executables there. I used to use $rescomp instead of asm compiler since I didn't know else I can pass there executable path. If we can define custom variables in "Compiler settings -> Toolchain executables -> Program files" that solves my issue. I don't thing it's really so hard.
BTW currently there are several predefined rules to auto generate sources from files like y, pyx and so on, but there are just calls to harcoded binaries by name. That may be very hard to find how to set them for one who doesn't know about =).