编程知识 cdmana.com

Ruffian scale embedded: Development notes of super download algorithm (rt-ufl) (1) - executed in different cm cores


   Hello everyone , I'm ruffian Heng , It's a serious technical ruffian . What the ruffian Heng introduced to you today is Super download Algorithm Development Notes (1) The difference is in execution CM Under kernel .

   The article is continued from the last part 《RT-UFL - One platform wide i.MXRT Super download algorithm design of 》, This project has been officially launched . Ruffian Heng said he would record RT-UFL All difficulties and solutions in the project development process , Share with you the mystery behind the design of download algorithm .

   This is the first development note , Let's focus on the foundation of this project , That is, how to make a .FLM( It's the ultimate executable machine code ) Can be in all i.MXRT The chip can work normally .

One 、 From the perspective of embedded program i.MXRT Family differences

   Because the super download algorithm runs on all i.MXRT Under the model , First of all, we need to know i.MXRT What are the family models 、 What's the difference between these different models , Which differences are the main factors affecting the super download algorithm .

   The following table shows the current i.MXRT The whole family has come out 9 Model No ( notes : Some models have more than one chip , But it's just the difference in the number of internal peripherals ):

   Although from the perspective of the chip itself, there will be more differences , But we can learn from the three most fundamental elements of an embedded program ( Instructions 、 Peripheral operation 、 Link space ) To analyze one by one :

   We can see from the above table that i.MXRT It's all based on ARM Cortex-M Kernel , This is actually the most important foundation for the whole project , Their instruction set is in the same line . But it's all Cortex-M kernel , But there are three kernel processor versions involved (M4、M7、M33), Therefore, when designing super download algorithm, the first thing to consider is the processor version difference .

   From the perspective of peripherals , Super download algorithm code may involve the operation of chip internal Clock( The clock )、IOMUXC( Pin )、FlexSPI(Flash controller ) And other peripherals , These peripherals will be different , But it doesn't matter , We can be different for i.MXRT Models introduce different code processing branches .

   Finally, from the link space , The super download algorithm is to be loaded inside RAM To perform the , these i.MXRT Inside RAM Different sizes , And the address in the system mapping address space is also slightly different , But it doesn't matter , If you have read the article written by ruffian Heng before 《 Serial NOR Flash Download algorithm (Keil MDK Tools section ) 》, You should know that the download algorithm code is location independent links , Its loading address can not be fixed ( By supporting xml File or IDE Additional designation in engineering setup ), therefore RAM It doesn't matter .

Two 、 solve Cortex-M Different versions of the processor have different instructions

   After the analysis in the previous section , We know how to solve the super download algorithm in i.MXRT The most important problem in running the whole series is to deal with different Cortex-M Kernel instruction differences .

   Before solving the problem of instruction discrepancy , There is an important problem that ruffian Heng has to clarify , That's the difference Cortex-M Chip in which the broken vector table sequence definition is not the same , front 16 It's a system vector , This is from ARM Stipulated , But the latter interrupt vectors are customized by the manufacturer . Different chip models , The vector numbers assigned by the same type of peripherals are not necessarily the same , So for some heterogeneous dual core embedded programs , Need to deal with interrupt vector table differences . But for download algorithms , It's not a problem , Because the download algorithm is not a general embedded program , It does not contain interrupt vector table , This means that the interrupt response function is not used in the download algorithm , Can't turn on peripheral interrupt ( This is caused by location independent links ).

   good , Let's solve the problem of instruction discrepancy now . see ARM Official sources have learned that ,Cortex-M The family has 10 Processor (M0、M0+、M1、M3、M23、M4、M33、M35P、M7、M55), It belongs to four architecture specifications (ARMv6-M、ARMv7-M、ARMv8-M、ARMv8.1-M), Architecture is mainly related to instruction set .

   Two more Cortex-M Instruction set diagram , We can see from the picture that Cortex-M0/M0+/M1 Processor based on ARMv6-M framework , This is a support only for 56 Small instruction set of instructions ( The blue box marks ), all Cortex-M All processors support this 56 Instruction set of instructions .

   Do you have any insight when you see this ?ARM The company is actually trying to make Cortex-M The user's software can be reused , Specially designed Cortex-M The processor gives it downward compatibility 、 Software binary upward compatibility features . Generally speaking, it is in the lower version Cortex-M The machine code compiled on the processor can be in a higher version Cortex-M Execute directly on the processor .

   So in order to realize the super download algorithm in i.MXRT On the whole series (M4、M7、M33) function , We just need to do one thing , That's the source of the generated algorithm file MDK Choose from the project settings Cortex-M0 The processor will do , Is it super simple ? If you download CMSIS_5 package , The default processor in the download algorithm template project is ARMCM0, It's not just an accident !

   thus , Super download Algorithm Development Notes (1) The difference is in execution CM Under the core, the ruffian Heng is introduced , Where is the applause ~~~

Welcome to subscribe to

The article will also be posted to my Blog Park home page CSDN Home page Zhihu Homepage WeChat official account On the platform .

WeChat search " Ruffian scale embedded " Or scan the QR code below , You can watch it for the first time on your mobile phone .

版权声明
本文为[Ruffian balance]所创,转载请带上原文链接,感谢

Scroll to Top