Bash Script to find discrepancies in BSP file organization

Vipul Nayyar nayyar_vipul at yahoo.com
Sun Sep 8 14:46:31 UTC 2013


Hello Joel,


Really thanks for your inputs. !! :-)

I agree with you that most of the flaws found can be corrected with proper naming. Since the output is from the script, so I've tested the authenticity of it only on a few bsps, but successfully.

The powerpc/mpc55xxevb bsp has the wrong name for bspgetworkarea.c with startup/bspworkareainit.c. So, just naming it right will correct it.

The internal routines like _Thread _Start_multitasking() & _fatal..() are actually mentioned in comments in bsp.  But not all internal routines are mentioned in comment, most of them are actually being called.  So that's an important point that you mentioned.

As Gedare suggested about searching for a  ';' after function names. I'd like to say that I've already devised the regex for that successfuly. But only if the function name & ; appear in the same line. I'm not sure how to accomplish that when function call starts at one line & ; appears in another. Will need to think more about it.

I'd like to say that even if a flaw is just an incorrect naming, it's still a problem that my script needs to point out, since the goal is to follow unified rules. :-D

Will improve the working of script as required. Can you have a brief look at the script & suggest any modifications if required ?

Regards
Vipul Nayyar


________________________________
 From: Joel Sherrill <Joel.Sherrill at OARcorp.com>
To: Gedare Bloom <gedare at rtems.org> 
Cc: Vipul Nayyar <nayyar_vipul at yahoo.com>; "rtems-devel at rtems.org" <rtems-devel at rtems.org> 
Sent: Sunday, 8 September 2013 7:35 PM
Subject: Re: Bash Script to find discrepancies in BSP file organization
 


Given the talk of reorganizing the libcpu and libbsp structure, I would personally ignore the cache definitions BUT they feel VERY wrong to be defined in a bsp. They should be more related to a CPU core. Bsp_reset should be defined by every bsp. That is a fairly recent addition and maybe those need the infinite loop stub added. It is also possible some had reset code at the bottom of start.S. double check .. May be a script issue missing some. Otherwise, we need to address. I am suspicious of the bspprederiverhook missings. The bsp would not compile and link if this was missing. I also don't like the explicit heap calls in gen5200. That is wrong. Every bsp must have bspgetworkarea. So that must be a script issue. It wouldn't link. _BSP_put_char is just a bad name choice. We should change those. Calling _ fatal error routines seems wrong. Probably a mistake. And why is a bsp directly calling _Thread _Start_multitasking. That seems wrong. _BSP... Print
 exception frame has to be named incorrectly. If we ignore the cache and isr CPU dependent helpers, I would worry about bsp reset and getworkarea. The latter almost certainly is a false positive. The first could be some false positives.  But as I mentioned, some are likely indicative of naming problems and can be fixed. Gedare Bloom <gedare at rtems.org> wrote: 
You can add the script to rtems-testing.git (there is already check_bsp there i think). Check for using internal rtems functions versus defining them, e.g. by checking for a semicolon. Some of the uses you flag like the _CPU_Cache_xxx are defining those functions, which i think is ok.. Joel?
-Gedare
On Sep 8, 2013 5:59 AM, "Vipul Nayyar" <nayyar_vipul at yahoo.com> wrote:

Hello Gedare,
>
>
>I reviewed the current documentation for bsp development as you suggested. I didn't find any major discrepancies present already, but will look again closely. As far I think, the part about the PIC support which is available to every BSP is currently not present in the documentation, so I'll submit the addition to docs regarding this if you also agree to it. 
>
>
>My current script gives results on a per bsp basis. However, as you requested to classify the problems, I've done that by tweaking it a little. I've added the functionality to search for RTEMS internal functions being used in the bsp. From what I understood, these internal functions I've looked for in BSPs are taken from libcpu & cpukit. 
>
>
>My aim in developing this bash script was to identify flaws in BSPs , and also to provide a simple tool for future BSP developers so that they can check the file organization for their BSP. So, is it fine if I submit a patch to add this script to the RTEMS tree ??
>
>
>Following, you'll find discrepancies found in current RTEMS tree regarding some serious flaws. The attached file all_warnings.txt classifies the flaws found in all bsps, either it being serious or not. The attached file 'per_bsp_observation.txt' contains result of the script showing serious flaws in all the bsps.
>
>
>
>
>
>**** RTEMS Internal functions being used in BSPs ****
>arm/csb336 : _BSP_poll_char()
>
>
>arm/edb7312 : _CPU_ISR_install_vector()
>
>
>arm/gp32 : _BSP_put_char()
>
>
>arm/lpc24xx : _CPU_ISR_install_vector() _Heap_Extend()
>
>
>arm/rtl22xx : _BSP_put_char()
>
>
>m68k/av5282 : _CPU_cache_disable_instruction() _CPU_cache_enable_instruction() _CPU_cache_invalidate_entire_instruction() _CPU_cache_disable_data() _CPU_cache_enable_data() _CPU_cache_invalidate_entire_data() _CPU_cache_flush_entire_data() _CPU_cache_unfreeze_instruction() _CPU_cache_freeze_instruction() _CPU_cache_invalidate_1_instruction_line() _CPU_cache_unfreeze_data() _CPU_cache_freeze_data() _CPU_cache_invalidate_1_data_line() _CPU_cache_flush_1_data_line()
>
>
>m68k/gen68340 : _CPU_ISR_install_raw_handler()
>
>
>m68k/genmcf548x : _CPU_cache_disable_instruction() _CPU_cache_enable_instruction() _CPU_cache_invalidate_entire_instruction() _CPU_cache_disable_data() _CPU_cache_enable_data() _CPU_cache_invalidate_entire_data() _CPU_cache_flush_entire_data() _CPU_cache_unfreeze_instruction() _CPU_cache_freeze_instruction() _CPU_cache_invalidate_1_instruction_line() _CPU_cache_unfreeze_data() _CPU_cache_freeze_data() _CPU_cache_invalidate_1_data_line() _CPU_cache_flush_1_data_line() _Thread_Start_multitasking()
>
>
>m68k/mcf5225x : _CPU_cache_disable_instruction() _CPU_cache_enable_instruction() _CPU_cache_invalidate_entire_instruction() _CPU_cache_disable_data() _CPU_cache_enable_data() _CPU_cache_invalidate_entire_data() _CPU_cache_flush_entire_data() _CPU_cache_unfreeze_instruction() _CPU_cache_freeze_instruction() _CPU_cache_invalidate_1_instruction_line() _CPU_cache_unfreeze_data() _CPU_cache_freeze_data() _CPU_cache_invalidate_1_data_line() _CPU_cache_flush_1_data_line()
>
>
>m68k/mrm332 : _CPU_ISR_Set_level() _CPU_Fatal_halt()
>
>
>m68k/uC5282 : _CPU_cache_disable_instruction() _CPU_cache_enable_instruction() _CPU_cache_invalidate_entire_instruction() _CPU_cache_disable_data() _CPU_cache_enable_data() _CPU_cache_invalidate_entire_data() _CPU_cache_flush_entire_data() _CPU_cache_unfreeze_instruction() _CPU_cache_freeze_instruction() _CPU_cache_invalidate_1_instruction_line() _CPU_cache_unfreeze_data() _CPU_cache_freeze_data() _CPU_cache_invalidate_1_data_line() _CPU_cache_flush_1_data_line()
>
>
>powerpc/gen5200 : _Heap_Free() _Heap_Initialize() _Heap_Allocate()
>
>
>powerpc/qoriq : _CPU_SMP_Send_interrupt()
>
>
>sparc/erc32 : _BSP_Exception_frame_print() _CPU_ISR_install_raw_handler()
>
>
>sparc/leon2 : _BSP_Exception_frame_print() _CPU_ISR_install_raw_handler()
>
>
>sparc/leon3 : _BSP_Exception_frame_print() _CPU_ISR_install_raw_handler() _CPU_SMP_Send_interrupt()
>
>
>**** bsggetworkarea not compiled ****
>powerpc/mpc55xxevb
>
>
>**** bspreset.c not compiled ****
>arm/gumstix
>avr/avrtest
>bfin/bf537Stamp
>bfin/eZKit533
>bfin/TLL6527M
>h8300/h8sim
>lm32/milkymist
>m32c/m32cbsp
>m68k/av5282
>m68k/csb360
>m68k/gen68302
>m68k/gen68340
>m68k/gen68360
>m68k/genmcf548x
>m68k/idp
>m68k/mcf5206elite
>m68k/mcf52235
>m68k/mcf5225x
>m68k/mcf5235
>m68k/mcf5329
>m68k/mrm332
>m68k/mvme136
>m68k/mvme147
>m68k/mvme147s
>m68k/mvme162
>m68k/mvme167
>m68k/ods68302
>m68k/sim68000
>mips/genmongoosev
>mips/hurricane
>mips/jmr3904
>mips/rbtx4925
>mips/rbtx4938
>moxie/moxiesim
>nios2/nios2_iss
>powerpc/beatnik
>powerpc/ep1a
>powerpc/haleakala
>powerpc/mbx8xx
>powerpc/mpc55xxevb
>powerpc/mpc8260ads
>powerpc/mvme3100
>powerpc/psim
>powerpc/qemuppc
>powerpc/score603e
>powerpc/ss555
>powerpc/tqm8xx
>powerpc/virtex4
>powerpc/virtex5
>powerpc/virtex
>sh/gensh1
>sh/gensh2
>sh/gensh4
>sh/shsim
>sparc64/niagara
>sparc64/usiii
>sparc/erc32
>sparc/leon2
>sparc/leon3
>
>
>****start.S not compiled ****
>m68k/ods68302
>powerpc/haleakala
>
>
>****bsppredriverhook.c not compiled ****
>lm32/lm32_evr
>lm32/milkymist
>powerpc/mvme3100
>powerpc/score603e
>powerpc/virtex4
>powerpc/virtex5
>sparc/erc32
>sparc/leon2
>sparc/leon3
>
>
>****PIC Support not included *****
>arm/gdbarmsim
>avr/avrtest
>bfin/bf537Stamp
>bfin/eZKit533
>bfin/TLL6527M
>h8300/h8sim
>lm32/lm32_evr
>lm32/milkymist
>m32c/m32cbsp
>m32r/m32rsim
>m68k/av5282
>m68k/csb360
>m68k/gen68302
>m68k/gen68340
>m68k/gen68360
>m68k/genmcf548x
>m68k/idp
>m68k/mcf5206elite
>m68k/mcf52235
>m68k/mcf5225x
>m68k/mcf5235
>m68k/mcf5329
>m68k/mrm332
>m68k/mvme136
>m68k/mvme147
>m68k/mvme147s
>m68k/mvme162
>m68k/mvme167
>m68k/ods68302
>m68k/sim68000
>m68k/uC5282
>moxie/moxiesim
>nios2/nios2_iss
>powerpc/beatnik
>powerpc/ep1a
>powerpc/haleakala
>powerpc/motorola_powerpc
>powerpc/mvme3100
>powerpc/mvme5500
>powerpc/score603e
>powerpc/ss555
>powerpc/virtex4
>powerpc/virtex5
>sh/gensh1
>sh/gensh2
>sh/gensh4
>sh/shsim
>sparc64/niagara
>sparc64/usiii
>v850/gdbv850sim
> 
>Hoping to hear from you soon !!
>
>
>
>
>Regards
>Vipul Nayyar 
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20130908/fad682a5/attachment-0001.html>


More information about the devel mailing list