The github repository is a clone, better submitting patches that I can apply on a subversion checkout.
Giovanni
LPC8xx port
- Giovanni
- Site Admin
- Posts: 14565
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1112 times
- Been thanked: 937 times
- Contact:
Re: LPC8xx port
Here's a first attempt. Most of the boring work is done, I think. The missing bit is the alarm code, which I assume is for the new tickless functionality. The files added are as follows, I think it's close to the conventions adopted for 3.x:
Does this help?
-jcw
UPDATE: more patches (mostly osal stuff, which I had overlooked), resulting compile now ends with this:
New "lpc3a" patch attached, includes all of the first patch as well.
Code: Select all
chibios-lpc (master +) ➤ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: demos/LPC/RT-LPC812-EA_MAX/Makefile
# new file: demos/LPC/RT-LPC812-EA_MAX/chconf.h
# new file: demos/LPC/RT-LPC812-EA_MAX/halconf.h
# new file: demos/LPC/RT-LPC812-EA_MAX/main.c
# new file: demos/LPC/RT-LPC812-EA_MAX/mcuconf.h
# new file: demos/LPC/RT-LPC812-EA_MAX/readme.txt
# new file: os/common/ports/ARMCMx/compilers/GCC/ld/LPC812.ld
# new file: os/common/ports/ARMCMx/devices/LPC8xx/cmparams.h
# new file: os/ext/CMSIS/NXP/lpc8xx.h
# new file: os/ext/CMSIS/NXP/system_LPC8xx.h
# new file: os/hal/ports/LPC/LPC8xx/ext_lld.c
# new file: os/hal/ports/LPC/LPC8xx/ext_lld.h
# new file: os/hal/ports/LPC/LPC8xx/ext_lld_isr.c
# new file: os/hal/ports/LPC/LPC8xx/ext_lld_isr.h
# new file: os/hal/ports/LPC/LPC8xx/gpt_lld.c
# new file: os/hal/ports/LPC/LPC8xx/gpt_lld.h
# new file: os/hal/ports/LPC/LPC8xx/hal_lld.c
# new file: os/hal/ports/LPC/LPC8xx/hal_lld.h
# new file: os/hal/ports/LPC/LPC8xx/pal_lld.c
# new file: os/hal/ports/LPC/LPC8xx/pal_lld.h
# new file: os/hal/ports/LPC/LPC8xx/platform.mk
# new file: os/hal/ports/LPC/LPC8xx/serial_lld.c
# new file: os/hal/ports/LPC/LPC8xx/serial_lld.h
# new file: os/hal/ports/LPC/LPC8xx/spi_lld.c
# new file: os/hal/ports/LPC/LPC8xx/spi_lld.h
# new file: os/hal/ports/LPC/LPC8xx/st_lld.h
# new file: os/nil/ports/ARMCMx/compilers/GCC/mk/port_lpc8xx.mk
#
Does this help?
-jcw
UPDATE: more patches (mostly osal stuff, which I had overlooked), resulting compile now ends with this:
Code: Select all
[...]
Compiling ext_lld_isr.c
Compiling board.c
Compiling main.cpp
Linking build/ch.elf
/var/folders/zj/b87xh4pj56v1g9nsvc1q6k580000gn/T//cc3f0EUA.ltrans0.ltrans.o: In function `stInit':
/Users/jcw/Desktop/new-code/jeeapps/blink-lpc812ea/../../chibios/os/hal/src/st.c:66: undefined reference to `st_lld_init'
collect2: error: ld returned 1 exit status
make: *** [build/ch.elf] Error 1
New "lpc3a" patch attached, includes all of the first patch as well.
- Attachments
-
- lpc3a.patch.gz
- (31.03 KiB) Downloaded 551 times
-
- lpc3.patch.gz
- (30.99 KiB) Downloaded 525 times
Last edited by jcw on Thu May 22, 2014 5:33 pm, edited 1 time in total.
- Giovanni
- Site Admin
- Posts: 14565
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1112 times
- Been thanked: 937 times
- Contact:
Re: LPC8xx port
Sure it does, theShed can commit it when ready.
When porting just make sure to take Makefile, chconf.h and halconf.h from 3.0, there are differences.
Giovanni
When porting just make sure to take Makefile, chconf.h and halconf.h from 3.0, there are differences.
Giovanni
Re: LPC8xx port
Ok, great. I'll leave this for now - looking forward to get this going. After a first example, next LPC's should become easier.
-jcw
-jcw
Re: LPC8xx port
Trying to figure out how to add the missing st_lld.c logic, but I'm afraid I don't get it. Tickless means: "don't just fire ticks periodically and all the time, instead figure out when the next interrupt is needed, and set up a timeout for exactly that point in time", right? So the idea is to make some (any?) timer do the work by setting up a one-shot event?
How does ChibiOS deal with time? In 3.0, the STM32 code picks a timer and uses that for the ST (SysTick?).
Why isn't the SysTick hardware being used, which is present in every ARM chip?
Both STM32 and LPC have general-purpose timers (with quite different hardware implementations).
In the case of the LPC8xx, there's a 4-channel "Multi-Rate Timer" (MRT), which is not tied to any I/O pins.
It doesn't have compare registers, just countdowns (either one-shot or repetitive).
I suspect that it'll accumulate some lost ticks when set to different values, but that should be ok for a first attempt.
-jcw
How does ChibiOS deal with time? In 3.0, the STM32 code picks a timer and uses that for the ST (SysTick?).
Why isn't the SysTick hardware being used, which is present in every ARM chip?
Both STM32 and LPC have general-purpose timers (with quite different hardware implementations).
In the case of the LPC8xx, there's a 4-channel "Multi-Rate Timer" (MRT), which is not tied to any I/O pins.
It doesn't have compare registers, just countdowns (either one-shot or repetitive).
I suspect that it'll accumulate some lost ticks when set to different values, but that should be ok for a first attempt.
-jcw
- Giovanni
- Site Admin
- Posts: 14565
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1112 times
- Been thanked: 937 times
- Contact:
Re: LPC8xx port
In tickless mode the system time is no more a variable incremented by the system tick, it is an hardware register incremented at a fixed rate. A comparator register generates an interrupt when the next deadline is reached. The virtual timers scheduler recalculates the next deadline each time a tick is processed.
The Cortex systick timer is not able to do that: it is only 24 bits large, does not have a prescaler and it is decremented instead of incremented.
Giovanni
The Cortex systick timer is not able to do that: it is only 24 bits large, does not have a prescaler and it is decremented instead of incremented.
Giovanni
Re: LPC8xx port
Ok, thx. In that case, the LPC8xx may not be able to work tickless - its MRT is 32-bit, but countdown-only and no pre-scaler. Perhaps it could be tricked by using negated/complemented values everywhere?
I just found the logic for the OSAL_ST_MODE_PERIODIC mode, i.e. SysTick-based after all.
Hacking around to see if I can get that simpler case to work :)
-jcw
I just found the logic for the OSAL_ST_MODE_PERIODIC mode, i.e. SysTick-based after all.
Hacking around to see if I can get that simpler case to work :)
-jcw
Re: LPC8xx port
Success: here's the second part. The demo now compiles cleanly and blinks the RGB LEDs with the proper timing on an LPC812-MAX board. Apply the attached "lpc3a2" patch after the "lpc3a" patch (and ignore that first "lpc3" patch). There are some loose ends, marked with "//xxx" in the code. This is running in periodic mode, not tickless.
-jcw
-jcw
- Attachments
-
- lpc3a2.patch.gz
- (5.45 KiB) Downloaded 539 times
Re: LPC8xx port
Thanks for this.
I will try to take a look asap, unfortunately work keeps getting in the way - I have a looming 1st June deadline and about three weeks work left to do...
--
mike
PS. you can submit git pull requests to me, I work in git and use git-svn to push changes to SVN
I will try to take a look asap, unfortunately work keeps getting in the way - I have a looming 1st June deadline and about three weeks work left to do...
--
mike
PS. you can submit git pull requests to me, I work in git and use git-svn to push changes to SVN
Re: LPC8xx port
Thx. No rush - work comes first. Do you want to update your TheShed/ChibiOS "kernel_3_dev" branch first, and let me submit diffs against that? Otherwise please let me know against which github checkout you want me to submit these changes, and I'll clone and try to come up with a clean diff.
-jcw
-jcw
Who is online
Users browsing this forum: No registered users and 2 guests