[GSOC] lpc24xx observations
Gedare Bloom
gedare at rtems.org
Mon Aug 26 14:21:38 UTC 2013
On Sun, Aug 25, 2013 at 6:36 AM, Vipul Nayyar <nayyar_vipul at yahoo.com> wrote:
> Hello,
>
> Covering for earlier incomplete work left..
> I've compiled a bit of information related to how the lpc24xx BSP is
> organized. The details can also be found here
> https://docs.google.com/document/d/1W9DMnpocXUKXiQMxHbbp0aG-ecuh94P-3N7hxEJmcgs/edit.
>
> I've tried to cover as much as files as possible. Since the aim here is to
> note how a unified way for a BSP implementaion should be, therefore the
> rules will cover those modules of BSP that are present or should be present
> in every BSP. Please have a look & tell if I've missed any common file that
> is common across all BSPs or I've included something extra that is only
> present in lpc24xx.
>
> The following structure & rules need to be accepted by the community &
> improved, so that I can automate checking of these rules.
> So that the following info is also present on the list & everyone can review
> it, I'm posting it below :
>
> /* Startup Files */
>
> File : startup/bspstart.c
> bsp_start() // Performs BSP specific initializations
> bsp_pretasking_hook() // Empty fo routines using shared framework
> initialize_console() // (Static function, used in bsp_start())
>
> File : startup/bspstarthooks.c
> bsp_start_hook_0()
> bsp_start_hook_1()
>
> File : startup/bspreset.c
> bsp_reset() // Reset
>
These three files are BSP optional, because not all BSPs need custom
initialization support and instead can share initialization code with
other BSPs in the same architecture or even use the generic shared
implementations. There are also other files that can go into startup,
for example bspgetworkarea.c.
You can learn more at
http://rtems.org/onlinedocs/doc-current/share/rtems/html/bsp_howto/Initialization-Code-Board-Initialization.html#Initialization-Code-Board-Initialization
>
> /* Interrupt related files */
>
> File : irq/irq.c
> bsp_interrupt_vector_enable() // Enable interrupt
> bsp_interrupt_vector_disable() // Disable interrupt
> bsp_interrupt_facility_initialize() // Initialize Interrupt Controller , Do
> other BSP specific initialization.
OK these are good.
> bspxx_irq_get_priority() // Set priority for a vector
> bspxx_irq_is_valid() // Returns true or false depending on whether a vector
> is valid or not.
I think these are specific to the lpc arm BSPs and should not be generalized.
> I think the inline function bsp_interrupt_is_valid_vector() present in
> irq-generic.h should be used instead
> of this. Since, the latter function checks both the lower & upper bounds.
>
Usually the lower bound on IRQs is 0. If the type is unsigned, you
don't need to check a lower bound in that case. Is this the situation?
> File : irq/irq-dispatch.c
> bsp_interrupt_dispatch() // Reads vector number & calls
> bsp_interrupt_handler_dispatch() , so as to service the interrupt with the
> appropriate handler.
>
So far only the ARM uses special per-BSP interrupt dispatch support.
However, other architectures might need it but just have it
implemented somewhere else, like in libcpu. (PowerPC has it too, but
only a little.)
> /* Miscellaneous */
>
> File : misc/timer.c
> benchmark_timer_initialize() // Initialize benchmark timer
> benchmark_timer_read() // Returns benchmark time units
> benchmark_timer_disable_subtracting_average_overhead()
>
Benchmark timers could be relocated to "timer" or "benchmark" or
similar subdirectory. (I always disliked the name timer since this
file is only for benchmark timing for tmtests.)
> File : misc/restart.c
> bsp_restart() // Restart
>
This is a non-generalized function. Maybe someone can comment on the
difference between restart and reset. We could make bsp_restart part
of the "startup" initialization routines, perhaps.
> File : misc/system-clocks.c
> bspxx_timer_initialize() // Initialize standard timer
>
This is specific support routine for lpc and should not be generalized.
> /* These above files should be moved to a more proper location, rather than
> keeping in a miscellaneous folder */
>
Some of them perhaps should be.
>
> /* Real time clock */
> File : rtc/rtc-config.c
> bspxx_rtc_initialize() // Initialize RTC chip
> bspxx_rtc_get_time() // Get time
> bspxx_rtc_set_time() // Set time
> bspxx_rtc_probe() // Returns true if device configured by this entry in the
> RTC_Table is present.
> /* As per BSP Device Driver Development Guide, the names of above function
> should be setRealTimeToRTEMS()
> and setRealTimeFromRTEMS(). I think so.. */
>
That setRealTime...() looks like an outdated function name. It should
be eliminated or replaced with some bsp_rtc_xxx() functions. We should
standardize the RTC interface to be similar to the other interfaces in
the BSP layer.
> /***********************************************************************************************************/
>
> /* Generic interrupt framework source files */
> File : libbsp/shared/src/irq-default-handler.c // Contains default interrupt
> handler
> File : libbsp/shared/src/irq-generic.c // Generic BSP interrupt support
> implementation
> File : libbsp/shared/src/irq-info.c //Generic BSP interrupt information
> implementation
> File : libbsp/shared/src/irq-legacy.c // Generic BSP interrupt support
> legacy implementation
> File : libbsp/shared/src/irq-server.c // Generic BSP interrupt server
> implementation
> File : libbsp/shared/src/irq-shell.c // Generic BSP interrupt shell
> implementation
>
OK I think you have been working on this code already?
> /* Standard Source files that need to be compiled for all BSPs (hopefully
> all..) */
> File : libbsp/shared/bootcard.c
> File : libbsp/shared/bspclean.c
> File : libbsp/shared/bspgetworkarea.c
> File : libbsp/shared/bsplibc.c
> File : libbsp/shared/bsppost.c
> File : libbsp/shared/bsppredriverhook.c
> File : libbsp/shared/gnatinstallhandler.c
> File : libbsp/shared/sbrk.c
> File : libbsp/shared/src/stackalloc.c
>
These can be mix-and-match between shared, architecture-specific, or
BSP-specific.
> /*************************************************************************************************************/
>
> /*Header files being installed according to Makefile.am */
>
> /*BSP specific Header files ( Should be named the same across all BSPs) :
> All BSP specific header files like irq.h , bsp.h etc should be present in
> the bsp/include folder only. */
>
> File : include/bsp.h // Global Definitions
> File : include/bspopts.h
> File : include/irq.h // Interrupt Definitions
> File : include/system-clocks.h // Declarations for standard timer in system
> clock
> File : include/lpc24xx.h // Register Definitions
> File : include/start-config.h // BSP start configuration
> File : include/lpc-clock-config.h // Clock driver configuration
>
> /* The list of installed headers from above can be more, depending on what
> extra support a BSP offers. The above present list can be said as a
> must-install list of bsp specific headers */
>
We should try to minimize the number of installed headers and justify
the ones that do get installed.
>
> /*Generic Interrupt related header files */
>
> File : libbsp/shared/shared/include/irq-generic.h // Generic BSP interrupt
> support API
> File : libbsp/shared/include/irq-info.h // Generic BSP interrupt information
> API.
>
> /*Standard Header Files */
>
> File : libbsp/shared/include/bootcard.h // Standard system startup.
> File : libbsp/shared/include/coverhd.h // Defines to represent the overhead
> associated with calling a particular directive from C
> File : libbsp/shared/include/utility.h // Utility macros
> File : libbsp/shared/include/stackalloc.h // Task stack initialization,
> allocation and free functions
> File : libbsp/shared/tod.h // Real Time Clock Declrations
> File : libbsp/shared/include/tm27.h // Timing test
>
>
> Hoping to hear your views & suggestions...
>
> Regards
> Vipul Nayyar
>
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel
>
More information about the devel
mailing list