@@ -11,7 +11,7 @@
\ ****************************************************************************/
: slof-build-id ( -- str len )
- flash-header 10 + a
+ flash-header 10 + dup from-cstring a min
;
: slof-revision s" 001" ;
@@ -11,7 +11,7 @@
\ ****************************************************************************/
: slof-build-id ( -- str len )
- flash-header 10 + a
+ flash-header 10 + dup from-cstring a min
;
: slof-revision s" 001" ;
@@ -27,12 +27,6 @@
bdate2human $cat encode-string THEN
;
-\ Fetch C string
-: from-cstring ( addr - len )
- dup dup BEGIN c@ 0 <> WHILE 1 + dup REPEAT
- swap -
-;
-
: invert-region-cs ( addr len cellsize -- )
>r over swap r@ rshift r> swap 1 hv-logical-memop drop
;
@@ -107,6 +107,11 @@ CONSTANT <2constant>
: str= ( str1 len1 str2 len2 -- equal? )
rot over <> IF 3drop false ELSE comp 0= THEN ;
+: from-cstring ( addr - len )
+ dup dup BEGIN c@ 0 <> WHILE 1 + dup REPEAT
+ swap -
+;
+
: test-string ( param len -- true | false )
0 ?DO
dup i + c@ \ Get character / byte at current index
The existing code hardcodes the length of /openprom/model to 10 characters even though it is less than that - len("aik")==3. All 10 chars go to the device tree blob and DTC complains on such a property as there are characters after terminating null: aik@fstn1-p1:~$ dtc -f -I dtb -O dts -o dbg.dts dbg.dtb Warning (model_is_string): "model" property in /openprom is not a string This uses the real length and limits it by 10 to avoid breaking something. Since the same code parses the build id field, this moves from-cstring to a common place for both js2x and qemu boards. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- board-js2x/slof/helper.fs | 2 +- board-qemu/slof/helper.fs | 8 +------- slof/fs/base.fs | 5 +++++ 3 files changed, 7 insertions(+), 8 deletions(-)