cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX, Line ends in generated code

Posted on January 02, 2016 at 20:08

Using CubeMX eclipse plugin under linux.

The generated source code has windows style CR-LF lineends, what's very uncommon for this OS (and even for Mac OSX). This issue heavily bothers post processing tools which might working on the generated code (e.g. grep, awk, perl, …).

Could ST please change the code generation to have OS styled lineends (for Linux & OSX, this means LF without CR)?

Further, it would be nice, if the generated code comes without trailing whitespace.

Cheers, Joe
5 REPLIES 5
re.wolff9
Senior
Posted on January 03, 2016 at 15:14

It's linefeed (''\n'')  on Linux and carriage return (''\r'') on macos. IIRC.... 

Posted on January 04, 2016 at 08:31

''\r'' for MAC is very outdated. From starting with OSX, which is based upon BSD Unix, MAC has also ''\n'' lineends.

Posted on February 03, 2016 at 20:44

Don't we just write software to be able to deal with the formats that are in heavy/prevalent use? It's not 1970, and the horse left the barn a long time ago, there's no prospect they are going to get unified, you really have to work with what's out in the ecosystem than expect everything to conform to the standard you want to adopt. Got editors here quite capable of using either format, and filtering the file/line data is something an intern should be able to code in an afternoon.

If your tools aren't agnostic, it is your tool's fault.

I can see the utility of having this as a check box item, but honestly ST has bigger bugs and defects they should be concentrating on.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
stm32cube-t
Senior III
Posted on February 22, 2016 at 10:58

Hello,

Note that generated code use same line end format than the STM32 embedded software libraries themselves.

Are you requesting solely the generated code to comply to the OS specific line end format?

Thanks

Wingunder
Associate III

Indeed, CubeMX is still generating the Makefile, *.c and *.h with linefeeds under Linux. This is especially annoying when working with git repos that do not have linefeeds. Here's an example: https://github.com/Seeed-Studio/LoRaWan-E5-Node

My current (and also clumsy) work-around is to run dos2unix on all the generated files, mentioned above, every time I generate the code.

@stm32cube-t, is it not possible to at least add some button in the code generation options to disable linefeeds?

Such an option will be backwards compatible. Moreover, even on CRLF-OSes, people might not want the generator to generate their OS-type's endlines. Just imagine, you're working on Windows, but you're working on a git repo with Linux-type endlines.

Thanks