处理器之间的转换
我在工作中主要编写嵌入式代码。 我们有一个已经开发的大型长期项目,已经有几代了,现在为其编写的处理器已经停产,甚至可能无法继续使用同一制造商的处理器。 (过渡可能是从 TI 到瑞萨 FPU 微处理器)。 部分问题在于某些代码是用汇编语言编写的。
我正在寻找尽可能轻松地进行过渡的方法,并在将来需要这种过渡时使其更加顺利。
你有什么建议?
I'm writing mostly embedded code at work. We have a big long-term project that's been developed, and has several generations, and now the processor for which it was written is being discontinued and it might be impossible even to continue using processors from the same manufacturer. (The transition will be probably from TI to Renesas FPU-microprocessors).
Part of the problem is that some code is written in assembly.
I'm looking for ways to make the transition as painlessly as possible, and make it smoother if such a transition is needed in the future.
What can you suggest?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
生成尽可能多的代码的通用 C 版本。
如果您的目的是通过手动优化装配来实现最终实现,这似乎是浪费时间,但事实并非如此。
在针对新目标进行优化时,您可以重写汇编中的关键部分,但是拥有 C 版本首先可以让您在每个新目标上快速启动并运行一些东西,其次提供一个可读的参考实现以在优化时进行比较,两者这将使您的生活变得更加轻松。
此外,认识到没有必要对所有内容进行手动优化汇编,只需花费最多时间/占用最多空间的代码部分即可。 用汇编语言编写一个大型项目的全部内容几乎肯定会浪费不必要的精力。 其余的可以保留为通用 C。但是,在您的 C 版本启动并运行并且可以对其进行分析之前,您不会知道应该关注什么。 你可以猜测,但你不会知道。
Produce a generic C version of as much of the code as possible.
This may seem like a waste of time if your intent is for the final implementation to be in hand-optimised assembly, but it really really is not.
When optimising for a new target, you can rewrite key sections in assembly, but having a C version will firstly let you have something up and running very quickly on each new target, and secondly provide a readable reference implementation to compare against when optimising, both of which will make your life much, much easier.
Moreover, realise there is no need for everything to be hand optimised assembly, just the sections of code where most time is spent / that take up the most space. To write all of a large project in assembly is almost certainly to waste effort unnecessarily. The rest can just stay as generic C. But you won't know what you should focus on until your C version is up and running and you can profile it. You can guess, but you won't know.