Reputation: 1
I am working on a task to move a big project from old Codewarrior IDE to S32DS from NXP, which use a compiler of GCC 4.9. Unluckily I have big troubles to compile the inline assembley code in S32DS, since the grammar of inline assembley are quite different from codewarrior to GCC. Any ideas to solve this problem without rewrite sentence by sentence? Any quick translate tools as shortcut? Thanks!
Upvotes: -1
Views: 184
Reputation: 363980
Your choices include porting to pure C (often best for inline asm that was a performance optimization for old bad compilers but which modern compilers can do on their own. Or which isn't relevant on another ISA).
Otherwise yes, you'd have to port to either standalone asm functions, or GNU C inline asm syntax. Stand-alone asm functions avoids having to get all the constraints right, and might be a good option for larger blocks.
Asm to asm translation don't typically exist, especially not to GNU C inline asm. (Or at least I've never seen anyone mention one on Stack Overflow).
BTW, GCC4.9 is pretty old. GCC7 and 8 have some nice new optimization capabilities, e.g. load/store coalescing (multiple narrow struct or array members loaded/stored with one full-register width load or store). I'd recommend starting with a current GCC version when you don't already have a working codebase so there's no risk of compiler changes introducing regressions.
Also, GCC6 introduced flag output operands from inline asm: a branch condition can be a boolean output from the asm.
Upvotes: 0