
Hi Alex, On 02/03/2014 03:25 PM, Alex J Lennon wrote:
On 03/02/2014 15:14, Niklas Hauser wrote:
While the interfaces are pretty much done, we still need to code the platform-specific implementation for those and this takes time. We currently focus on all STM32F0 through STM32F4 devices, as these are the ones we use most frequently.
Understood
Actually (and what Niklas probably isn't aware of) one of my projects for our robotics club is using the lpc11c24 microcontroller. Thus I'll need to get at least the Gpio, the Uart and the CAN driver running on this platform within the next couple of months.
However, the hard stuff like startup scripts and build system integration are done, we just have not used an LPC in our robots since we started the restructuring.
As Niklas said the startup script and all cortex specific stuff is shared and can be found here: https://github.com/roboterclubaachen/xpcc/tree/develop/src/xpcc/architecture... In order to use the interrupts on your controller you will need to add a vendor- (or rather part-) specific interrupt table.
(Presumably as a start there would need to be a new XML configuration file, as you mentioned in the talk?
For the xml configuration file you can have a look at the one for the lpc11c24: https://github.com/roboterclubaachen/xpcc/blob/develop/src/xpcc/architecture... I created that one by hand in order to test the drivers. That is the reason why I only added the pins that I needed to the gpio driver. When you start with a new architecture it is always a good idea to build up the first device file step by step. When your code works you can always check and see if there is a source that you can use in order to generate device files from.
In short: at minimum there needs to be a new device file and a good implementation of GPIO. You would also need a startup and linker script, but we already have some.
For a rudimentary linker script you can just copy the one for the lpc11c24 and change the memory sizes. A quick look at the memory layout of your chip might be helpful in case NXP decided to go with different starting addresses. The linker scripts go into the linker directory and need to be referred to in the xml device file. https://github.com/roboterclubaachen/xpcc/tree/develop/src/xpcc/architecture... Startup stuff is covered by the cortex core driver that I mentioned earlier. Depending on your chip you might have to handle some specific cases, like setting the Interrupt Vector Controllers vector table address correctly. I had a quick look at the LPC176x/5x User manual and it seems like NXP did not screw up the GPIO quite as badly as they did with the lpc11c24 where they had to dedicate one page in the manual for every pin, because they all work differently. So a GPIO driver could probably be implemented in about two or three days (by someone who is new to xpcc). Also you will need a clock driver if you do not want to be stuck with the startup frequency. For this you can have a look at the implementation for the lpc11c24: https://github.com/roboterclubaachen/xpcc/tree/develop/src/xpcc/architecture... This can be a little bit hard to grasp because it uses Jinja2 Templates as well as C++ quite extensively. However, feel free to ask questions on the mailinglist if you are stuck. One advice I can give you is to first create some code that sets up the clock frequency and outputs that on one of the pins. As soon as his works you can try to move this to an xpcc driver, or maybe integrate with the existing driver for the lpc11c24. Short note on the subject of driver names: If there is only one driver (e.g. for the lpcs we only have drivers for lpc11c24 at the moment) we normally name it as short as possible. That's why all the drivers for the lpc11c24 are named `lpc`. If you discover, that you cannot make the existing lpc drivers work for the lpc1768, you should at a new driver called `lpc17`, because it can be assumed (or at least hoped for) that it will work for all NXP microcontrollers of the lpc17 series.
I will write a more detailed wiki entry and link it here for the benefit of all. Give me till end of this week.
That is a great idea. Alex: if you want you can have a look at the things I mentioned earlier in this mail and ask on the mailing list if or rather when there are additional questions. That might help in collecting topics that the wiki article should address. Kevin