New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL8195AM - refactor bootloader and fota support #5531

Merged
merged 2 commits into from Nov 30, 2017

Conversation

Projects
None yet
6 participants
@tung7970
Contributor

tung7970 commented Nov 20, 2017

Description

Refactor bootloader and fota support.

  1. redefine OTA flash regions

OTA regions are moved to 0x040000 and 0x120000 to make room for mbed credentials and settings.

  1. redefine bootloader headers

Headers are redefined for better integration with mbed cloud FOTA services.

Status

READY

Migrations

NONE

Related PRs

NONE

Todos

NONE

Deploy notes

NONE

Steps to test or reproduce

NONE

targets/TARGET_Realtek/TARGET_AMEBA/ota_api.h Outdated
#define OTA_TAG_OFS 0x0
#define OTA_VER_OFS 0x4
#define OTA_EPOCH_OFS 0x8
#define OTA_SIZE_OFS 0xf

This comment has been minimized.

@marcuschangarm

marcuschangarm Nov 20, 2017

Contributor

Shouldn't the size offset be 0x10?

This comment has been minimized.

@tung7970

tung7970 Nov 20, 2017

Contributor

Yeap. It should be 0x10. Thanks.

@marcuschangarm

This comment has been minimized.

Contributor

marcuschangarm commented Nov 20, 2017

@tung7970

I'm unable to boot up. This is the error I'm getting:

Image1 Validate OK, Going jump to Image1
BOOT from Flash:YES
SPI calibration
Find the avaiable window
SDR Controller Init:0; Delay start:0; Delay end:63
Test 0: No match addr 0xc9d38 => 0xf != 0xc
Test 0: No match addr 0x1f7c10 => 0x5 != 0xe
ram2: crc32 4d32fd02 <==> f3fc3585
ram2: crc32 9be76dba <==> aceefcf9
Unable to boot image 2

@tung7970 tung7970 force-pushed the tung7970:feature-fota branch 2 times, most recently to d1d31c7 Nov 20, 2017

@tung7970

This comment has been minimized.

Contributor

tung7970 commented Nov 21, 2017

@marcuschangarm Hi, updated bootloader. Please give it a try. Thanks.

@marcuschangarm

This comment has been minimized.

Contributor

marcuschangarm commented Nov 21, 2017

@tung7970 It works now! We are back in business!

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Nov 22, 2017

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Nov 22, 2017

@kegilbert

This comment has been minimized.

Contributor

kegilbert commented Nov 22, 2017

When running locally looks like a string is being passed in the number argument to format_number causing the

line = format(number, '0%dx' % (width))
ValueError: Unknown format code 'x' for object of type 'str' 

error.

Specifically the RAM2_HEADER tag and ver fields look like junk when running on the event_flags test for example.

@marcuschangarm

@marcuschangarm

This comment has been minimized.

Contributor

marcuschangarm commented Nov 22, 2017

I don't understand why not all of the compilations are failing. In the trace output, most of the binaries are created correctly.

What command are you using? When I build locally it works:

mbed test --compile -m REALTEK_RTL8195AM -t GCC_ARM
@kegilbert

This comment has been minimized.

Contributor

kegilbert commented Nov 22, 2017

Running the same command I can reproduce the error on the CI test node and on a local Linux machine both running Python 2.7.12.

That's really strange, I'm honestly not sure why only certain builds cause it. It doesn't seem to happen to the same binaries each time.

@marcuschangarm

This comment has been minimized.

@tung7970 tung7970 force-pushed the tung7970:feature-fota branch from d1d31c7 Nov 23, 2017

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Nov 24, 2017

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Nov 24, 2017

Build : SUCCESS

Build number : 592
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5531/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@marcuschangarm

This comment has been minimized.

Contributor

marcuschangarm commented Nov 28, 2017

Can we get this in before the freeze, please? 😄

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Nov 28, 2017

Can we get this in before the freeze, please? 😄

Waiting for review from @theotherjimmy (tools changes)

@0xc0170

The print might be removed, the rest LGTM

targets/TARGET_Realtek/TARGET_AMEBA/ota_api.c Outdated
return 0;
}
printf("OTA: read addr=0x%lx\r\n", addr);
return flash_ext_stream_read(&flash_obj, addr, len, data);
printf("OTA: read addr=0x%lx\r\n", start);

This comment has been minimized.

@0xc0170

0xc0170 Nov 28, 2017

Member

is this debug print? Should not print always?

tung7970 added some commits Nov 10, 2017

rtl8195am - cleanup post-processing binary hook
Preparing for bootloader redesign.

Signed-off-by: Tony Wu <tung7970@gmail.com>
rtl8195am - refactor bootloader and ota support
1. move ota region 1 from 0x00b000 to 0x040000
2. move ota region 2 from 0x0c0000 to 0x120000
3. refactor bootloader header as follows:

   uint32_t tag;
   uint32_t ver;
   uint64_t timestamp;
   uint32_t size;
   uint8_t hash[32];
   uint8_t campaign[16];
   uint32_t crc32;

   where,
   a. hash is the sha256 checksum of the payload.
   b. crc32 is the crc32 checksum of headers from tag to campaign.

4. Call NVIC_SystemReset for soft reset.

Signed-off-by: Tony Wu <tung7970@gmail.com>

@tung7970 tung7970 force-pushed the tung7970:feature-fota branch to a4575a9 Nov 28, 2017

@tung7970

This comment has been minimized.

Contributor

tung7970 commented Nov 28, 2017

@0xc0170 Done.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Nov 28, 2017

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Nov 28, 2017

Build : SUCCESS

Build number : 614
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5531/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Nov 28, 2017

Before I approve this, @tung7970 Are the tools changes backwards compatible? That is, If I were to use the tools directory to compile, say, Mbed OS 5.5.7, would it work?

@tung7970

This comment has been minimized.

Contributor

tung7970 commented Nov 29, 2017

@theotherjimmy Yes. This commit is atomic, as long as python script and bootloader bin are used together.

@theotherjimmy

Thanks. Be aware this this will upgrade all website builds to the new bootloader when the tools on the website are upgraded. This includes older releases of Mbed OS.

@0xc0170 0xc0170 merged commit e413350 into ARMmbed:master Nov 30, 2017

6 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment