Skip to content

Target support for Infineon's XMC 4XXX family. #6730

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

Closed
wants to merge 17 commits into from

Conversation

mbed-Infineon-XMC
Copy link

Description

Add target support for Infineon's XMC 4XXX MCU familiy.

Tested with the XMC 4500 Relax Kit development board and the ARM GCC toolchain.
Tested serveral examples which are available here: https://github.com/mbed-Infineon-XMC

Pull request type

[ ] Fix
[ ] Refactor
[x] New target
[ ] Feature
[ ] Breaking change

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 24, 2018

@mbed-Infineon-XMC Hi, thanks for the contribution ! We are going to review this soon.

Can you look at the travis failure?

Tested with the XMC 4500 Relax Kit development board and the ARM GCC toolchain.

Can you attach the test results here? We recommend testing all 3 toolchains

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 25, 2018

Please ignore PR head for now (not related to this pull request). But travis still fails after the last updates.

SW2 = P1_15,
USBTX = P0_5,
USBRX = P0_4,
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this protected with relax kit ?

I assume this file is generic for MCU family and this is the addition for a target that has this specific definitions?

@@ -4007,5 +4007,26 @@
"detect_code": ["7013"],
"release_versions": ["5"],
"bootloader_supported": true
}
},
"XMC_XXXX": {
Copy link
Contributor

Choose a reason for hiding this comment

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

misaligned line?

"macros_add": ["XMC4500_F100x1024", "XMC4500_Relax_Kit", "XMC_ETH_PHY_KSZ8031RNL", "USE_LWIP"],
"features_add": ["LWIP"],
"OUTPUT_EXT": "hex",
"device_name": "XMC4500"
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 fix alignment for XMC4500, line 4030, 4028 and 4027

*/
int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size){

XMC_FLASH_ProgramPage((uint32_t *)address, (uint32_t *)data);
Copy link
Contributor

Choose a reason for hiding this comment

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

XMC_FLASH function do not return anything , that these functions here always return 0

Copy link
Author

Choose a reason for hiding this comment

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

Function should always return 0. The low level function 'XMC_FLASH_programPage()' is a void function so I get no meaningful return value.
I know it's not a good pratice... However, I do not want to make any changes in the low level hardware library provided by Infineon. (XMC Lib)

*/
int32_t flash_init(flash_t *obj){

return 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

does not need any init? neither free?

Copy link
Author

Choose a reason for hiding this comment

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

Same as i 'flash_program_page'. Flash driver not need any initialization!

*
* @param obj The flash object
* @return 0 for success, -1 for error
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

why are doxygen doc being copied to the implementation?

Copy link
Author

Choose a reason for hiding this comment

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

I will remove the doxygen doc in all files!

/** Initialize the RTC peripheral
*
*/
void rtc_init(void){
Copy link
Contributor

Choose a reason for hiding this comment

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

{ new line for function body, al lfunctions in this file should be updated

// // Configure system during SLEEP state
// XMC_SCU_CLOCK_SetSleepConfig(XMC_SCU_CLOCK_SLEEP_MODE_CONFIG_SYSCLK_FPLL); //TODO: why pll clock is divided by 2
//
// // Make sure that SLEEPDEEP bit is cleared
Copy link
Contributor

Choose a reason for hiding this comment

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

why sleep and deepsleep is empty?

the dead code should be removed

/* pin configuration for i2c sdc */
XMC_GPIO_CONFIG_t i2c_scl_pin_cfg =
{
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_MEDIUM
Copy link
Contributor

Choose a reason for hiding this comment

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

@mbed-Infineon-XMC
Copy link
Author

@0xc0170 Hi, thanks for reviewing the source code. I will fix these issues...

I'm new with Travis CI, is there a way to execute the travis tests on my local workstation?
It's hard for me to understand the travis log output and what those travis tests are exactly doing.

Thanks

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 25, 2018

I'm new with Travis CI, is there a way to execute the travis tests on my local workstation?
It's hard for me to understand the travis log output and what those travis tests are exactly doing.

I reviewed them. Based on the errors, I would start with fixing the alignment in the targets.json file that I pointed above in my review. One of the CI failures is on the line 4032 as I noticed.

you can run them locally. There's .travis.yaml that contains the commands that travis executes. You can reproduce those locally (sometimes they contain some travis specific variables that you might need to replace with known values).

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 26, 2018

Travis is now green 👍

Can you answer my questions above?

* limitations under the License.
*/

// library provided by https://github.com/wizard97/Embedded_RingBuf_CPP
Copy link
Contributor

Choose a reason for hiding this comment

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

As this is taken from there, should this file b e unde the same license, MIT ? We provide circular bufferin platform folder, is not sufficient or?

Where is class this used?

Copy link
Author

Choose a reason for hiding this comment

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

OK... I will use the Circular Buffer implementation which is already available in mbed-os/platform.
Have overlooked this class :)

#define MBED_OS_CIRCULAR_BUFFER_H_

#include "mbed.h"
#include "rtos.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

include what is needed , rtos and mbed header files are for an application space. This would cause inclusion of unnecessary files

@0xc0170
Copy link
Contributor

0xc0170 commented May 3, 2018

@mbed-Infineon-XMC Looking at the USB. why is it in targets? are those files used anywhere? I would assume not, thus could be removed. And USB support should come as separate PR.

There is feature usb branch, that is bringing USB support.

@mbed-Infineon-XMC
Copy link
Author

@0xc0170 I removed the USB functionality...
I will add USB support for the XMC familiy at a later time to the USB feature branch!

0xc0170
0xc0170 previously approved these changes May 7, 2018
@0xc0170
Copy link
Contributor

0xc0170 commented May 7, 2018

/morph build

@0xc0170 0xc0170 requested a review from ashok-rao May 7, 2018 08:11
@mbed-ci
Copy link

mbed-ci commented May 7, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented May 7, 2018

@mbed-ci
Copy link

mbed-ci commented May 7, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented May 7, 2018

/morph mbed2-build

@cmonr
Copy link
Contributor

cmonr commented May 7, 2018

@ashok-rao We'll wait a day or two since you were at GEC. Otherwise, it's ready to go!

@ashok-rao
Copy link
Contributor

Thanks @cmonr , will look at this tomorrow!

@cmonr
Copy link
Contributor

cmonr commented May 8, 2018

@mbed-Infineon-XMC In the meanwhile, did you ever answer @0xc0170's request to post test results?


USBTX = P0_5,
USBRX = P0_4,

Copy link
Contributor

Choose a reason for hiding this comment

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

@mbed-Infineon-XMC , what about other peripherals? Can you please add pin maps for any other peripherals that are brought out like SPI, I2C..?

Copy link
Author

Choose a reason for hiding this comment

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

USBTX and USBRX are useful because they are needed for the standard serial output.
Do not think that it make sense to declare default pin maps for I2C, SPI etc..
The application programmer must always now what he has connected to a specific pin.
In my view this makes only sense for development boards where Led's, Buttons or other peripehrals are fix connected. As i see, other target implementations have a similar style!
How do you think about that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't the XMC4500 going to be supplied as a development board? Or is this going to be a build only target in Mbed OS and the HW implementation is left to the user? Could you please clarify @mbed-Infineon-XMC . If there is a board with this MCU, then the peripheral pins must be defined here for application code to use.. something like: FileSystem sd(SPI_MOSI, SPI_MISO....) that needs the peripheral pins defined here to be used later in main.cpp ..

"XMC_XXXX": {
"inherits": ["Target"],
"extra_labels": ["Infineon", "XMCLib"],
"supported_toolchains": ["GCC_ARM", "ARM"],
Copy link
Contributor

Choose a reason for hiding this comment

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

No support for IAR? if yes, you may want to add linker scripts for IAR as well.
@0xc0170 : Is IAR support mandatory or optional?

Copy link
Contributor

@cmonr cmonr May 8, 2018

Choose a reason for hiding this comment

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

IAR support is mandatory, as without it tests and export builds will fail with IAR.

For reference: #6043 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

@mbed-Infineon-XMC ..Could you please add IAR support as well. You will need to add the linker scripts too under ../device/TOOLCHAIN_IAR/

Copy link
Author

Choose a reason for hiding this comment

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

ARM compiler also not supported yet!
I will add support for IAR and ARM in the next days.
Should the Exporter & build test not fail if there is no support for all 3 toolchains?

Copy link
Contributor

Choose a reason for hiding this comment

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

@mbed-Infineon-XMC : The Mbed Enabled requirement is to have support for all 3 toolchains. The CI systems also test the targets against these 3 toolchains. So, if any 1/3 is not present, it will fail :-)

@cmonr
Copy link
Contributor

cmonr commented May 23, 2018

@mbed-Infineon-XMC Fyi, if IAR and ARM compilers aren't supported, they'll fail hte ci-morph-test and ci-morph-exporter tests.

@cmonr
Copy link
Contributor

cmonr commented May 29, 2018

@mbed-Infineon-XMC @ashok-rao Closing this PR due to lack of activity.

Feel free to reopen once updates are available.

@cmonr cmonr closed this May 29, 2018
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.

7 participants