-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
@mbed-Infineon-XMC Hi, thanks for the contribution ! We are going to review this soon. Can you look at the travis failure?
Can you attach the test results here? We recommend testing all 3 toolchains |
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 |
There was a problem hiding this comment.
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?
targets/targets.json
Outdated
@@ -4007,5 +4007,26 @@ | |||
"detect_code": ["7013"], | |||
"release_versions": ["5"], | |||
"bootloader_supported": true | |||
} | |||
}, | |||
"XMC_XXXX": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misaligned line?
targets/targets.json
Outdated
"macros_add": ["XMC4500_F100x1024", "XMC4500_Relax_Kit", "XMC_ETH_PHY_KSZ8031RNL", "USE_LWIP"], | ||
"features_add": ["LWIP"], | ||
"OUTPUT_EXT": "hex", | ||
"device_name": "XMC4500" |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 | ||
*/ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 spaces instead of 4?
@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? Thanks |
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). |
Travis is now green 👍 Can you answer my questions above? |
* limitations under the License. | ||
*/ | ||
|
||
// library provided by https://github.com/wizard97/Embedded_RingBuf_CPP |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
@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. |
@0xc0170 I removed the USB functionality... |
/morph build |
Build : SUCCESSBuild number : 1925 Triggering tests/morph test |
Test : SUCCESSBuild number : 1746 |
Exporter Build : SUCCESSBuild number : 1570 |
/morph mbed2-build |
@ashok-rao We'll wait a day or two since you were at GEC. Otherwise, it's ready to go! |
Thanks @cmonr , will look at this tomorrow! |
@mbed-Infineon-XMC In the meanwhile, did you ever answer @0xc0170's request to post test results? |
|
||
USBTX = P0_5, | ||
USBRX = P0_4, | ||
|
There was a problem hiding this comment.
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..?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ..
targets/targets.json
Outdated
"XMC_XXXX": { | ||
"inherits": ["Target"], | ||
"extra_labels": ["Infineon", "XMCLib"], | ||
"supported_toolchains": ["GCC_ARM", "ARM"], |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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/
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :-)
@mbed-Infineon-XMC Fyi, if IAR and ARM compilers aren't supported, they'll fail hte ci-morph-test and ci-morph-exporter tests. |
@mbed-Infineon-XMC @ashok-rao Closing this PR due to lack of activity. Feel free to reopen once updates are available. |
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