简体   繁体   English

使用Arduino IDE进行编程是否适合商业产品?

[英]Is programming using the Arduino IDE suitable for commercial products?

I need to program a microcontroller in such a way that I EXACTLY know what it will be doing, because it is for a project that requires high levels of reliability (similar to automotive products). 我需要对微控制器进行编程以使我完全知道它将要做什么,因为它是针对要求高可靠性的项目(类似于汽车产品)而设计的。

I know my way around in C (started 9 years ago) so ideally I would code everything myself using the ATMEL official framework, compile it with AVR-GCC and burn the EEPROM with AVRDude. 我知道我的C语言(开始于9年前),因此理想情况下,我将自己使用ATMEL官方框架编写所有代码,并使用AVR-GCC进行编译,并使用AVRDude烧写EEPROM。 There is also the method of uploading the .hex to the bootloader already burned to avoid using an in circuit programmer (done by Arduino). 还有一种方法,将.hex上传到已经烧掉的引导程序中,以避免使用在线编程器(由Arduino完成)。 No surprises. 没什么好奇怪的

However, the framework is -obviously- very low level. 但是,该框架显然很低。 I don't really have the time to manipulate the registers directly every time I use an ADC or send data on the USART (actually more prone to error). 每次使用ADC或在USART上发送数据时,我实际上都没有时间直接操纵寄存器(实际上更容易出错)。 So I thought the Arduino library can't be unreliable given all the time it's been out there (it has the C++ syntax but why not). 所以我认为,鉴于Arduino库一直存在,它不会是不可靠的(它具有C ++语法,但为什么不这样)。

But actually, if I'm going to use the Arduino libraries, what is wrong with using the entire Arduino IDE for a commercial product? 但是实际上,如果我要使用Arduino库,那么将整个Arduino IDE用于商业产品又有什么问题呢? What does programming via the Arduino IDE hide (to make it simpler for the users) that makes it "not trusted" for commercial applications? 通过Arduino IDE进行的编程隐藏了什么(使用户更简单),从而使其对于商业应用程序“不受信任”? Or is it a myth? 还是神话?

The libraries of Arduino are effective but not efficient. Arduino的库有效,但效率不高。 They where developed for users with little knowledge of hardware or software. 它们是为几乎不了解硬件或软件的用户开发的。

For example, take a look at the hardwareSerial.cpp module and see it uses internal loops for sending data, instead of using serial interrupts. 例如,看一下hardwareSerial.cpp模块,发现它使用内部循环发送数据,而不是使用串行中断。 This blocks your sketch until it finishes sending data. 这会阻塞您的草图,直到完成数据发送为止。

Like this example there are some more, and are the reason why i program my own libraries most of the time. 像这个例子一样,还有更多,这就是为什么我大部分时间都在编写自己的库的原因。

Totally give up the idea that using Arduino lib in a commercial products. 完全放弃了在商业产品中使用Arduino lib的想法。 Not only because it's in-efficiently, but also because the Thread Safety is not guaranteed. 不仅因为效率低下,而且因为不能保证线程安全性。 For example, some variables and data-structures (queue) are not protected from ISR context to main context, which may cause data integrity issue or even random Hard Fault. 例如,某些变量和数据结构(队列)没有从ISR上下文到主上下文的保护,这可能导致数据完整性问题,甚至是随机的Hard Fault。 Although the probability is low, you should still give up the idea unless the quality of your products is not important. 尽管可能性很小,但除非产品质量不重要,否则您还是应该放弃这个主意。

On the other hand, low efficiency means you have to pay more hardware budget on the processor, also make it improper in commercial products. 另一方面,低效率意味着您必须为处理器支付更多的硬件预算,也使其不适用于商业产品。

People like Arduino because they want a rapid developing. 人们喜欢Arduino,因为他们想要快速发展。 If you write an solid framework yourself you will be able to develop products fast, also solid. 如果您自己编写一个可靠的框架,您将能够快速,稳定地开发产品。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM