[Jan 14] KDE Neon (20190113-1500) - Pinebook1080P / Pinebook |[Jan 14] Q4OS (2.7-r1) - Pinebook1080P / Pinebook | [Dec 07] DietPi(v6.18) - Pinebook / Manjaro KDE (preview3) / Manjaro LXQT (preview3) - Pinebook |[Dec 06] Armbian Debian Stretch (5.67) / Armbian Ubuntu 18.04 Bionic Desktop (5.67) - RockPro64 |[Dec 05] DietPi(v6.18) - 1080P Pinebook

Project Inspiration | Get Started | IRC Logs | Forum Rules/Policy


ARM mbed
#11
Hi kssste

I've tried out installing the mbed OS as you stated above in this thread, but I had to stop at step 7. What modifications are needed? Even with the patch done with git as instructed `mbed status' reports no changes. I guess I need to some git command to change to master, to see the changes to the main tree?

After a `mbed config root .' in the mbed-os dir, I can now run `mbed compile' in the mbed-os directory and it starts compiling, though giving a warning that it finds an relatively old gcc. Unsurprisingly it can't find a main() on linking.

Now where to put one's project? Is `mbed' capable of finding out its installed place for reach-over? Or should I first need to set 'mbed config root  .' with options -G ?

With regards,
Reinoud
Reply
#12
I've managed to get the wifi example compiled and it gives me the following segments :


Code:
    Program Header:
    0x70000001 off    0x0004e424 vaddr 0x1005538c paddr 0x1005538c align 2**2
         filesz 0x00000008 memsz 0x00000008 flags r--
        LOAD off    0x00000098 vaddr 0x10007000 paddr 0x10007000 align 2**3
         filesz 0x0004e394 memsz 0x00069000 flags rwx
        LOAD off    0x0004e42c vaddr 0x1fff0000 paddr 0x1fff0000 align 2**2
         filesz 0x00000000 memsz 0x0000a000 flags rw-
    private flags = 5000002: [Version5 EABI] [has entry point]

    Sections:
    Idx Name              Size      VMA       LMA       File off  Algn
      0 .image2.table     00000018  10007000  10007000  00000098  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
      1 .wlan.rom.rodata  000001bc  10007018  10007018  000000b0  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
      2 .text.sram1       0004bd44  100071d8  100071d8  00000270  2**3 CONTENTS, ALLOC, LOAD, READONLY, CODE
      3 .hal.flash.text   0000169c  10052f1c  10052f1c  0004bfb4  2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE
      4 .data.sram1       00000d38  100545b8  100545b8  0004d650  2**3 CONTENTS, ALLOC, LOAD, DATA
      5 .hal.flash.data   00000090  100552f0  100552f0  0004e388  2**0 CONTENTS, ALLOC, LOAD, DATA
      6 .hal.ram.data     0000000c  10055380  10055380  0004e418  2**2 CONTENTS, ALLOC, LOAD, DATA
      7 .ARM.exidx        00000008  1005538c  1005538c  0004e424  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
      8 .bss.sram1        0000b000  10055398  10055398  0004e42c  2**3 ALLOC
      9 .heap             0000ec68  10060398  10060398  0004e42c  2**0 ALLOC
     10 .TCM_overlay      0000a000  1fff0000  1fff0000  0004e42c  2**2 ALLOC
     11 .stack_dummy      00001000  1006f000  1006f000  0004e42c  2**0 ALLOC
 ....


In my naivety I distilled the following forrtlaimage.py


Code:
    image = [xFirmwareImage('ram_1', ['.image2.table', '.wlan.rom.rodata', '.text,sram1', '.hal.flash.text', '.data.sram1', '.hal.flash.data', '.hal.ram.data'], HM_IS_SRAM, 0x10007000, 0x10070000),
             xFirmwareImage('ram_2', ['.image2.table', '.text.sram1', '.data.sram1', 'bss.sram1'], HM_IS_OTA + HM_IS_HDRR + HM_IS_SRAM, 0x10007000, 0x10070000),
             xFirmwareImage('sdram', ['.sdr_text', '.sdr_rodata', '.sdr_data'], HM_IS_OTA + HM_IS_HDRD + HM_IS_SDRAM, 0x30000000, 0x30200000)]

But although the generated ota.bin looks OK at first glance, its not accepted as a valid Image2 at 0x80000 nor at 0xb000 for that matter when uploaded in Flash by the OpenOCD's script.

What am I doing wrong here?
Thanks in advance,
Reinoud
Reply
#13
Dear folks,

I've updated my rtlaimage.py to have :

Code:
    image = [xFirmwareImage('ram_1', ['.image2.table', '.wlan.rom.rodata', '.text.sram1', '.hal.flash.text', '.data.sram1', '.bss.sram1'], HM_IS_OTA + HM_IS_HDRR + HM_IS_SRAM, 0x10007000, 0x10070000),
             xFirmwareImage('sdram', ['.sdr_text', '.sdr_rodata', '.sdr_data'], HM_IS_OTA + HM_IS_SDRAM, 0x30000000, 0x30200000)]
   

and it now generates an accepted, and working(!), OTA image I can upload to the PADI using the SWD/OpenOCD/rtl8710.ocd combination at 0x80000.


Code:
WiFi example
Mbed OS version 99.99.99


Initializing WIFI ...
[_rtx2_create_task] [rtw_little_wifi_mcu_thread]priority is higher than osPriorityRealtime
WIFI initialized
Scan:
< results omitted >
12 networks available.

Connecting to MyPlace...
RTL8195A[Driver]: set ssid [MyPlace]
RTL8195A[Driver]: start auth to xx:xx:xx:xx:xx:xx
RTL8195A[Driver]: auth success, start assoc
RTL8195A[Driver]: association success(res=2)
RTL8195A[Driver]: UpdateHalRAMask8195A(): mac_id=0 rssi_level=0
RTL8195A[Driver]: UpdateHalRAMask8195A(): mac_id=0 raid=0x3 bw=0 mask=0xff005 init_rate=0x13
RTL8195A[Driver]: set pairwise key to hw: alg:4(WEP40-1 WEP104-5 TKIP-2 AES-4)
RTL8195A[Driver]: set group key to hw: alg:4(WEP40-1 WEP104-5 TKIP-2 AES-4) keyid:2
WIFI is already runningSuccess

MAC: 00:06:dc:8c:fb:f1
IP: 192.168.1.157
Netmask: 255.255.255.0
Gateway: 192.168.1.254
RSSI: -72

Sending HTTP request to www.arm.com...
RTL8195A[Driver]: UpdateHalRAMask8195A(): mac_id=0 rssi_level=1
RTL8195A[Driver]: UpdateHalRAMask8195A(): mac_id=0 raid=0x3 bw=0 mask=0xff000 init_rate=0x13
sent 58 [GET / HTTP/1.1]
recv 64 [HTTP/1.1 200 OK]

ioctl[SIOCGIWESSID] ssid = NULL, not connected
Done
Note that I had to insert a loop that printed around a 5000 integers just at the start before any code was executed to get the output. I haven't tried out gdb over OpenOCD yet Smile

A possible cause for the incidental failures could be :
Code:
[_rtx2_create_task] [rtw_little_wifi_mcu_thread]priority is higher than osPriorityRealtime
Since this could cause timing depended behaviour.

Thanks for the pointers!
Reinoud
Reply
#14
Great news! Please provide more details.

Which bootloader have you used?
I've have just realized that you left the original PADI provided one there and used OTA @0x80000 partition. Good idea. So, needed to put the signature and the binary.

The rtlaimage.py is from RtlDuino github?

Thank you
Reply
#15
I have tried your trick, OTA & print 5000 numbers.

Unfortunately, does not help. I'm still getting freezing.


Code:
4920,4921,4922,4923,4924,4925,4926,4927,4928,4929,4930,4931,4932,4933,4934,4935,4936,4937,4938,4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954,4955,4956,4957,4958,4959,4960,4961,4962,4963,4964,4965,4966,4967,4968,4969,4970,4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,4981,4982,4983,4984,4985,4986,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999,Mbed OS version 99.99.99


Initializing WIFI ...
[_rtx2_create_task] [rtw_little_wifi_mcu_thread]priority is higher than osPriorityRealtime
WIFI initialized
Scan:

<stops there>
Reply
#16
(11-07-2018, 02:52 PM)kissste Wrote: I have tried your trick, OTA & print 5000 numbers.

Unfortunately, does not help. I'm still getting freezing.
Code:
4920,4921,4922,4923,4924,4925,4926,4927,4928,4929,4930,4931,4932,4933,4934,4935,4936,4937,4938,4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954,4955,4956,4957,4958,4959,4960,4961,4962,4963,4964,4965,4966,4967,4968,4969,4970,4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,4981,4982,4983,4984,4985,4986,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999,Mbed OS version 99.99.99


Initializing WIFI ...
[_rtx2_create_task] [rtw_little_wifi_mcu_thread]priority is higher than osPriorityRealtime
WIFI initialized
Scan:

<stops there>

I've sporadically got those too. I first posted here about the priority of the thread but looking at the code it just maximises it so that was a red herring.

You did flash the PADI with the complete original firmware first and used my line in the python script that builds the OTA?
Reply
#17
I've created a small HOWTO on how to use mbed on the PADI. It is a start for a better README / tools page. It would be good to have a decent page on the website when support for the PADI in mbed is pulled up eventually.

Note that the PADI at times won't get passed its SSID query. It is not yet confirmed what causes this behavior.

Running ARM mbed on the PADI howto
==================================

First of all in stall `git', `mercurial', `python' and python's `pip'. Do this trough your favorite package manager.

Install OpenOCD version 0.9 and not version 0.10. The scripts used are tailored on this version.

Download the PADI-dist.tgz file and unpack in a directory
    cd ~
    ftp http://13thmonkey.org/PADI/PADI-dist.tgz
    tar xzf PADI-dist.tgz

    tar xzf PADI-dist/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2

Install mbed-cli using pip; this will install an `mbed' command:
    sudo pip2.7 install mbed-cli

Checkout the WiFi example. Go to whatever you want your project to live, in this example in ~. Then use the `mbed' command to get a copy of the WiFi example.
    cd ~/
    sudo mbed import mbed-os-example-wifi
    cd mbed-os-example-wifi

Update the installed mbed-os sources:
    cd mbed-os
    git fetch origin pull/7965/head:pr-7965
    git checkout pr-7965
    cd ..

Go back to the example directory and edit the "mbed_app.json" file filling in SSID and PASSWORD for your WiFi. Make sure you don't remove the \"!
    cd ../
    $EDITOR mbed_app.json

Configure mbed while in the example directory
    mbed config root .
    mbed config target REALTEK_RTL8710AF
    mbed toolchain GCC_ARM
    mbed config GCC_ARM_PATH ~/gcc-arm-none-eabi-4_8-2014q1/bin/

Copy in helper scripts
    cp ~/PADI-dist/PADI* .
    cp ~/PADI-dist/rtla* .

There should now be a couple of PADI.* files for easy programming, a file called rtl8710.ocf and a file called rtlaimage.py.

For safety, download the original FLASH rom using
    ./PADI.read-flash.sh
    cp dump.bin dump.VIRGIN.bin
    chmod -w dump.VIRGIN.bin

The FlashROM can be restored or repaired later to factory standard with
    ./PADI-restore-flash.sh

For easier debugging and testing, modify the "main.cpp" file to include a counting loop to get more time for connecting up the serial at the  start of main() :
    for (int i = 0; i < 5000; i++) printf("%d\n", i);

Compile example
    mbed compile
This should now give a complete image in ./BUILD/REALTEK_RTL8710AF/GCC_ARM/mbed-os-example-wifi.bin

Convert ELF file to an OTA image:
    python rtlaimage.py -r -a -o ./ ./BUILD/REALTEK_RTL8710AF/GCC_ARM/mbed-os-example-wifi.elf

Hook up the SWD debugger and program the PADI with `ota.bin' at address 0x80000 using the script:
    ./PADI-program-flash-mbed.sh

Power cycle the PADI and connect up using your favourite serial port monitor like `cu -l 38600 -l /dev/ttyU0" and see it count to 5000 and boot mbed, list the SSIDs around, logging in on the specified SSID and finally retrieving a webpage.

NOTE that it might be necessary to power the PADI when programming it with the SWD.
Reply
#18
(11-09-2018, 05:12 AM)Reinoud Wrote: I've created a small HOWTO on how to use mbed on the PADI. It is a start for a better README / tools page. It would be good to have a decent page on the website when support for the PADI in mbed is pulled up eventually.

Note that the PADI at times won't get passed its SSID query. It is not yet confirmed what causes this behavior.

Running ARM mbed on the PADI howto
==================================

First of all in stall `git', `mercurial', `python' and python's `pip'. Do
this trough your favorite package manager.

Install OpenOCD version 0.9 and not version 0.10. The scripts used are
tailored on this version.

Download the PADI-dist.tgz file and unpack in a directory
    cd ~
    ftp http://13thmonkey.org/PADI/PADI-dist.tgz
    tar xzf PADI-dist.tgz

    tar xzf PADI-dist/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2

Install mbed-cli using pip; this will install an `mbed' command:
    sudo pip2.7 install mbed-cli

Checkout the WiFi example. Go to whatever you want your project to live, in
this example in ~. Then use the `mbed' command to get a copy of the WiFi
example.
    cd ~/
    sudo mbed import mbed-os-example-wifi
    cd mbed-os-example-wifi

Update the installed mbed-os sources:
    cd mbed-os
    git fetch origin pull/7965/head:pr-7965
    git checkout pr-7965
    cd ..

Go back to the example directory and edit the "mbed_app.json" file filling in SSID and PASSWORD for your WiFi. Make
sure you don't remove the \"!
    cd ../
    $EDITOR mbed_app.json

Configure mbed while in the example directory
    mbed config root .
    mbed config target REALTEK_RTL8710AF
    mbed toolchain GCC_ARM
    mbed config GCC_ARM_PATH ~/gcc-arm-none-eabi-4_8-2014q1/bin/

Copy in helper scripts
    cp ~/PADI-dist/PADI* .
    cp ~/PADI-dist/rtla* .

There should now be a couple of PADI.* files for easy programming, a file
called rtl8710.ocf and a file called rtlaimage.py.

For safety, download the original FLASH rom using
    ./PADI.read-flash.sh
    cp dump.bin dump.VIRGIN.bin
    chmod -w dump.VIRGIN.bin

The FlashROM can be restored or repaired later to factory standard with
    ./PADI-restore-flash.sh

For easier debugging and testing, modify the "main.cpp" file to include a
counting loop to get more time for connecting up the serial at the start of
main() :
    for (int i = 0; i < 5000; i++) printf("%d\n", i);

Compile example
    mbed compile
This should now give a complete image in ./BUILD/REALTEK_RTL8710AF/GCC_ARM/mbed-os-example-wifi.bin

Convert ELF file to an OTA image:
    python rtlaimage.py -r -a -o ./ ./BUILD/REALTEK_RTL8710AF/GCC_ARM/mbed-os-example-wifi.elf

Hook up the SWD debugger and program the PADI with `ota.bin' at address
0x80000 using the script:
    ./PADI-program-flash-mbed.sh

Power cycle the PADI and connect up using your favourite serial port monitor
like `cu -l 38600 -l /dev/ttyU0" and see it count to 5000 and boot mbed, list
the SSIDs around, logging in on the specified SSID and finally retrieving a
file from http://www.arm.com.

NOTE that it might be necessary to power the PADI when programming it with the
SWD.

Appreciate and thanks on the sharing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)