Skip to content
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

Add WIFI support for RDA target UNO_91H #9501

Merged
merged 1 commit into from
Feb 13, 2019
Merged

Conversation

caixue1102
Copy link
Contributor

Description

Add support wifi for RDA target UNO_91H.
Tested with GCC_ARM, IAR and ARMCC.
Test report here:
RDA_UNO_91H_test_report.zip

Pull request type

[ ] Fix
[ ] Refactor
[x] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@ciarmcom
Copy link
Member

@caixue1102, thank you for your changes.
@ARMmbed/mbed-os-maintainers @ARMmbed/mbed-os-test @ARMmbed/mbed-os-ipcore please review.

@ciarmcom ciarmcom requested review from a team January 25, 2019 04:00
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, just that I would run astyle for implementation files of Mbed OS functionality (like emac port , or wifi interface - RdaWiFiInterface).

+1 for providing licenses for libs

Copy link
Contributor

@SeppoTakalo SeppoTakalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Driver looks OK, but I'm requesting changes for couple of things.

  • License header copy&pasted from other files and not updated to reflect this work. Now headers don't reflect the original author of these files, but instead say Copyright Arm
  • Small code style changes requested.
  • Usage of mbed_mac_address() without providing implementation for it.
  • Copied LwIP headers without clear explanation of why
  • tab used as indentation marker in targets.json file.

}
}
} else
find = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our style guide requires one line if-else clauses to have brackets as well.

find = true;

if (find == false) {
printf("can not find the ap.\r\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use mbed_trace or other loggers.
I don't think using printf() inside driver is acceptable, as you cannot disable the output from build time.

_blocking);

if (ret == NSAPI_ERROR_DHCP_FAILURE)
ret = NSAPI_ERROR_CONNECTION_TIMEOUT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you translate DHCP_FAILURE to CONNECTION_TIMEOUT?



nsapi_error_t RDAWiFiInterface::connect()
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the point why this cannot call RDAWiFiInterface::connect(const char *ssid, const char *paswd, nsapi_security_t security, uint8_t channel)

if(sta_state < 2)
return NSAPI_ERROR_NO_CONNECTION;

init();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you call init() here?

I would have assumed you to call power_down() or equivalent.

@@ -0,0 +1,135 @@
/* LWIP implementation of NetworkInterfaceAPI
* Copyright (c) 2019 ARM Limited
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, as previous.. You should not copy&paste the license section.

*/

#ifndef __DHCPS_H__
#define __DHCPS_H__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this file is copied from LwIP?



#ifndef LWIPOPTS_CONF_H
#define LWIPOPTS_CONF_H
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this file is copied from LwIP?


bool RDA5981x_EMAC::get_hwaddr(uint8_t *addr) const
{
mbed_mac_address((char *)addr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this function used anywhere else in the driver, are you sure that it actually provides the MAC address that this hardware uses?

If you don't provide implementation of mbed_mac_address() it gives you pseudo MAC address that is generated in build time.

"ANALOGIN",
"FLASH",
"TRNG"
"USTICKER",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tabulator used as indentation here.. Use spaces as the rest of the file.

@SeppoTakalo
Copy link
Contributor

Also, I would like to see test results as instructed in https://os.mbed.com/docs/mbed-os/v5.11/porting/wifi-port.html#testing

So provide log file from mbed test command running all network socket tests as well as WiFi tests.

See the Socket test plan what kind of mbed_app.json is required to run it properly.

@caixue1102 caixue1102 force-pushed the mbed-os-rda branch 2 times, most recently from 3c82a00 to c0cad4e Compare January 28, 2019 09:30
@caixue1102
Copy link
Contributor Author

thank you for the suggestions。

  1. coding style changes are made according to your suggestions.
  2. return values in connect function have been modified by determining the cause of the connection errors.
  3. you are right, we finally called RDAWiFiInterface::connect(const char *ssid, const char *paswd, nsapi_security_t security, uint8_t channel) in RDAWiFiInterface::connect();
  4. init() is useless in disconnect, so it has been removed.
  5. Copyright has been modified in all the files.
  6. LwIP headers are useless and they were removed.
  7. mbed_mac_address is used in wifi library function, and final used by the hardware.

@caixue1102
Copy link
Contributor Author

Also, I would like to see test results as instructed in https://os.mbed.com/docs/mbed-os/v5.11/porting/wifi-port.html#testing

So provide log file from mbed test command running all network socket tests as well as WiFi tests.

See the Socket test plan what kind of mbed_app.json is required to run it properly.

The test report pasted in the description is runned on the newest TEST case (netsocket and network)with 'mbed test' command , is there anything wrong with my operation? could you please give me some pointers?

@caixue1102
Copy link
Contributor Author

@SeppoTakalo please help to review the new changes, thank you very much~

@SeppoTakalo
Copy link
Contributor

@caixue1102 Sorry, I did not spot the attached log files.

Those are fine and look OK.

{
#if 1
return connect(_ssid, _pass, _security, _channel);
#else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, you might want to remove the dead code from the driver.
When left there, it soon gets outdated, and might be misleading for the next developer who tries to understand this driver.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, and I have remove the dead code just now.

}

}
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 requests, the rest looks fine

  • SPDX identifier addition
  • fixing coding style in the implementation files (emac/wifiinterface)

@@ -0,0 +1,160 @@
/* Copyright (c) 2019 Unisoc Communications Inc.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add SPDX identifier to new files please?

 * SPDX-License-Identifier: Apache-2.0

@caixue1102
Copy link
Contributor Author

@0xc0170 @VeijoPesonen Thank you, now coding style is fixed and SPDX identifier is added.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 31, 2019

CI started

@caixue1102
Copy link
Contributor Author

@0xc0170 thank you, this has been modified

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 11, 2019

CI restarted

@mbed-ci
Copy link

mbed-ci commented Feb 11, 2019

Test run: FAILED

Summary: 6 of 8 test jobs failed
Build number : 5
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_mbed2-build-ARM
  • jenkins-ci/mbed-os-ci_mbed2-build-IAR
  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_mbed2-build-GCC_ARM
  • jenkins-ci/mbed-os-ci_build-IAR
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 11, 2019

Please review build artifacts, there are failures:

[DEBUG] Output: "./cmsis/TARGET_CORTEX_M/mbed_fault_handler.c", line 23: Error: #5: cannot open source input file "device.h": No such file or directory

@caixue1102
Copy link
Contributor Author

@0xc0170 Thank you,I have modified target.json and now it can be compiled successfully using -m RDA5981X, I didn't find the failed reason before, because I used -m UNO_91H for all tests in the past.and now using -m RDA5981X can not get a emac.bin.

@cmonr
Copy link
Contributor

cmonr commented Feb 12, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Feb 12, 2019

Test run: SUCCESS

Summary: 12 of 12 test jobs passed
Build number : 6
Build artifacts

"ANALOGIN",
"FLASH",
"TRNG"
"USTICKER",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed this should be aligned as it was previously (4 spaces more to the right) ?

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 12, 2019

@caixue1102 Please send a new PR fixing the alignment or amend it here, let us know (will start CI)

@caixue1102
Copy link
Contributor Author

@0xc0170 thank you and it's modified.

@cmonr
Copy link
Contributor

cmonr commented Feb 12, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Feb 12, 2019

Test run: FAILED

Summary: 3 of 8 test jobs failed
Build number : 7
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-GCC_ARM
  • jenkins-ci/mbed-os-ci_build-IAR

@alekla01
Copy link
Contributor

Restarted CI after #9677

@mbed-ci
Copy link

mbed-ci commented Feb 12, 2019

Test run: SUCCESS

Summary: 12 of 12 test jobs passed
Build number : 8
Build artifacts

@cmonr cmonr merged commit 3e6cd4e into ARMmbed:master Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.