<html><body><div>On Jul 29, 2015, at 07:56 AM, Pavel Pisa <pisa@cmp.felk.cvut.cz> wrote:<br><br><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><span class="body-text-content">Hello Qiao Yang,<br><br>On Tuesday 28 of July 2015 01:35:45 Pavel Pisa wrote:<br></span></span><blockquote class="quoted-plain-text" type="cite">Hello Qiao Yang,</blockquote><blockquote class="quoted-plain-text" type="cite"><br></blockquote><blockquote class="quoted-plain-text" type="cite">On Friday 24 of July 2015 18:04:47 QIAO YANG wrote:</blockquote><blockquote class="quoted-plain-text" type="cite">> Some updates for you. I've found out that my previous problem with</blockquote><blockquote class="quoted-plain-text" type="cite">> cmdline due to my minicom didn't wrap up the lines.... I've chosen the</blockquote><blockquote class="quoted-plain-text" type="cite">> interface of vc to retrieve cmdline so that we don't need to parse the</blockquote><blockquote class="quoted-plain-text" type="cite">> atag nor devicetree. Now we can use --video=... to choose resolution and</blockquote><blockquote class="quoted-plain-text" type="cite">> --console=... to choose console.</blockquote><span class="body-text-content"><span class="body-text-content"><br>I have got to little more testing. Ticker runs correctly<br>with console on serial port and even with graphics console.<br>But option --console=fbcons works only if it is the last option<br>on the line in cmdline.txt. Problem is in the comparison because<br>if there are more options then string provided by rpi_cmdline_arg()<br>continues after "fbcons" by blank character. I think that<br>copy of the string to the user provided buffer is not necessary<br>in rpi_cmdline_arg(). It would bring up issues with space enough<br>to fit data etc. I have use simple strncmp to resolve issue.<br>But something more elegant can be provided.<br><br>diff --git a/c/src/lib/libbsp/arm/raspberrypi/console/console_select.c b/c/src/lib/libbsp/arm/raspberrypi<br>index 74cf78e..ad24d33 100644<br>--- a/c/src/lib/libbsp/arm/raspberrypi/console/console_select.c<br>+++ b/c/src/lib/libbsp/arm/raspberrypi/console/console_select.c<br>@@ -91,7 +91,7 @@ void bsp_console_select(void)<br> if (opt)<br> {<br> opt += sizeof("--console=")-1;<br>- if (strcmp(opt,"fbcons") == 0)<br>+ if (strncmp(opt,"fbcons", sizeof("fbcons"-1)) == 0)<br> {<br> Console_Port_Minor = BSP_CONSOLE_FB;<br> BSPPrintkPort = BSP_CONSOLE_FB;<br>@@ -99,8 +99,8 @@ void bsp_console_select(void)<br> }<br> else<br> {<br>- Console_Port_Minor = BSP_CONSOLE_FB;<br>- BSPPrintkPort = BSP_CONSOLE_FB;<br>+ Console_Port_Minor = BSP_CONSOLE_UART0;<br>+ BSPPrintkPort = BSP_CONSOLE_UART0;<br> }</span></span></div></div></blockquote><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><span class="body-text-content"><br><br> /*<br><br></span></span><blockquote class="quoted-plain-text" type="cite">As for the interface to command line through VC, I expect that</blockquote><blockquote class="quoted-plain-text" type="cite">this interface allows access only to value set in config.txt</blockquote><blockquote class="quoted-plain-text" type="cite">but it is not changed by U-boot if used. If that is true</blockquote><blockquote class="quoted-plain-text" type="cite">then use of ATAG or device tree would be better for flexibility.</blockquote><blockquote class="quoted-plain-text" type="cite">It would be reusable on other ARM targets as well.</blockquote><blockquote class="quoted-plain-text" type="cite">But that this can be tried in some follow up project.</blockquote><span class="body-text-content"><br>It seems to me that behavior is as expected, VideoCore<br>returns what it parsed from cmdline.txt but arguments<br>set by U-boot are different. So long term term solution<br>is to implement shared ARM BSP atags and devicetree parser.<br>It can be minimal for start only to locate kernel command<br>line. It would help to other ARM BSPs in general.<br><br>MMU setup seems to be OK for me, but what I really<br>dislike is duplicate of arm-cp15-start.h to RPi.<br>Shared one should be used.<br><br>Les problem is to use different name for<br>arm_cp15_start_mmu_config_table to not clash<br>with the definition in header.<br><br>I think that the name arm_cp15_start_mmu_config_table<br>is not part of RTEMS API so it can be changed freely<br>and if original arm_cp15_start_mmu_config_table<br>is not defined then incorrect use is catch<br>easily.<br><br>Please, try to resolve this first. Then the suggested<br>change for strncmp and do more testing.<br><br>I suggest to adapt rpi_init_cmdline() a little.<br><br>void rpi_init_cmdline(void)<br>{<br> bcm2835_get_cmdline_entries get_cmdline_entries;<br> bcm2835_mailbox_get_cmdline(&get_cmdline_entries);<br> int i; /*I suggest to be C89 compatible, do not<br> mix declaration with code in single block */<br> for (i = 0; i < MAX_CMDLINE_LENGTH; ++i)<br> {<br> _rpi_cmdline[i] = get_cmdline_entries.cmdline[i];<br> }<br>}<br><br>It is not necessary to place 512 bytes onto stack.<br>If you declare get_cmdline_entries static global<br><br>static bcm2835_get_cmdline_entries get_cmdline_entries;<br><br>Then you can read the line to this global.<br><br>If you declare then _rpi_cmdline as<br><br>char *_rpi_cmdline;</span></div></div></blockquote><span> </span><br>This is reasonable. I've updated it.<br><br><span></span><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><br><br>you only point it into right place and do not need<br>copy. You should add code, which ensures that command<br>line is zero terminated if you use strstr() later.<br><br>You can use something like<br><br><br> bcm2835_mailbox_get_cmdline(&get_cmdline_entries);<br> get_cmdline_entries.cmdline[sizeof(get_cmdline_entries.cmdline) - 1] = 0;</span></div></div></blockquote><span>After calling mailbox, I know exactly the length of cmdline and when I return the value to the entries, I've added a zero terminated character at the end. </span><br><br><br><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><br><br>Generally code division to the functions<br>and files looks good.<br><br>Best wishes, <br><br> Pavel<br></span></div></div></blockquote></div></div></body></html>