Multiple Processor Support in FreeRTOS (Not Multicore)

Is it possible to have a single image support multiple processors? Assume all are ARM M4 variants. Given the difficulties in procuring processors these days I am forced to support the same product with different processors. I do not want to have to support multiple images. Is it possible to pick the processor that is being run, with board id, and set a flag, or something, to run the drivers for that processor. Has anyone done this?

I don’t think FreeRTOS will get in the way of this idea. But you’d be in for a lot of work and potential frustration trying to get position independent code and data working. Remember that code will execute from different addresses on different targets, based on the location of flash in the memory map. Same applies to data in RAM.

And position independence is just the beginning of the trouble. Interrupt vectors, execution-time penalties, API differences in drivers, etc., are all additional challenges. I think the only suitable solution to supporting multiple diverse targets in the same application is multiple build configurations of the same code base.

As you probably know, if you can manage to stick to a single family of processors, using various different packages and different peripheral/flash/ram allocations, the goal of a single image is worthwhile and fairly easy to achieve. I have done this successfully in the recent past (probably like most other embedded developers recently :grinning: ).

1 Like

FreeRTOS itself won’t care which M4 your system is running on, as long as your code handles any of the differences in the stuff it is using.

As Jeff mentions, the big question is how different the processors are. It might be trivial if they are just different marks of the same processor family. If they are from different manufacturers, YOU are going to need to figure out how to figure out which type of machine you are on and redirect the various resources (the interrupt vector may be the big one).