-
Notifications
You must be signed in to change notification settings - Fork 90
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
Update Example Return Values #317
Conversation
should be able to merge main into this for new CI-test. |
Examples/MAX32572/AES/main.c
Outdated
} | ||
|
||
while (1) {} | ||
|
||
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.
This line might cause warning, like unreachable point...
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.
@ozersa and @Jake-Carter Can you build MAX32572 samples? When I import the projects on Eclipse I am seeing "Preprocessor Include Path/Entries/GNU C/CDT Cross GCC Built-in Compiler Settings" as empty. Therefore, the project can not find gcc command. This is why I have skipped MAX32572 samples.
Examples/MAX32520/CRC/main.c
Outdated
} else { | ||
printf(" Passed \n"); | ||
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.
It would be better just returning result,
The success return value must be consistent (zero) but fail case can be different (non-zero).
Instead of increasing code line just returning result will be better.
Please apply same idea for other cases in this PR.
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.
@ozersa this is an internal function. Moreover, such change may require many changes on other projects. Isn't it better to skip such change in our first iteration and somehow achieve to merge. @Jake-Carter what do you think?
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.
@karaanil I agree with @ozersa that this small internal function is probably not necessary.
If you really wanted to inform the user which CRCs are failing, I would suggest a simple printf like below.
int Test_CRC(int asynchronous)
{
// ...
ret = (CHECK != crc_req.resultCRC);
if (ret) printf( "Failed CRC check! Received: %x\tExpected: %x\n", crc_req.resultCRC, CHECK);
MXC_CTB_Shutdown(MXC_CTB_FEATURE_CRC | MXC_CTB_FEATURE_DMA);
return ret;
}
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.
It looks like only the CRC examples would need this cleanup
Examples/MAX32572/CRC/main.c
Outdated
} else { | ||
printf(" Passed \n"); | ||
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.
Examples/MAX32572/DES/main.c
Outdated
|
||
printf("\nExample complete.\n"); | ||
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.
Might give warning (unreachable line...), please check it.
Examples/MAX32572/DMA/main.c
Outdated
} | ||
|
||
while (1) {} | ||
|
||
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.
Examples/MAX32572/Hash/main.c
Outdated
} else { | ||
printf(" Passed \n\n"); | ||
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.
Same as above comment...
Examples/MAX32572/Hash/main.c
Outdated
} else { | ||
printf("Example Failed\n"); | ||
return -1; | ||
} | ||
|
||
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.
Examples/MAX32572/SDHC_Raw/main.c
Outdated
return -1; | ||
} | ||
|
||
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.
Examples/MAX32572/SPIXF/main.c
Outdated
} else { | ||
printf("Example Failed\n\n"); | ||
return -1; | ||
} | ||
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.
Examples/MAX32572/SPIXR/main.c
Outdated
} | ||
|
||
while (1) {} | ||
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.
Same as
https://github.com/Analog-Devices-MSDK/msdk/pull/317/files#r1063432996
Please apply it for all case in this PR
Examples/MAX32655/CRC/main.c
Outdated
@@ -140,11 +140,12 @@ int main(void) | |||
|
|||
if (fail) { | |||
printf("\Example Failed"); |
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.
Not related this PR but please fix typo add \n,
\E might cause some issue
} else { | ||
printf("-->EXAMPLE SUCCEEDED\n"); | ||
} | ||
|
||
while (1) { |
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.
The PR shall not change example functionality (as possible as),
In this case at the end of example led blinks, instead of removing this feature you should add a counter to blink the led n times, n can be 10.
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.
@ozersa which line blinks the LED? I am seeing that it is either off or on. Since GPIO's will preserve the state after code finishes, it should work as before. Am I wrong?
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.
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.
It is okay that we have such a while loop at the end. However, I am checking the code and it initially has blocking empty while loops at the top that changed to a simple return. I mean this portion mostly is not executed. Moreover, the other UART examples do not have such a loop in their original form. Therefore, removing this portion makes this example similar to the other UART examples.
Do we really need such a portion? Why others do not have it but MAX32660 has? @ozersa
@@ -218,15 +218,10 @@ int main(void) | |||
if (fail != 0) { | |||
LED_On(0); | |||
printf("-->EXAMPLE FAILED\n"); | |||
while (1) {} | |||
return E_FAIL; | |||
} else { | |||
printf("-->EXAMPLE SUCCEEDED\n"); | |||
} | |||
|
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.
Examples/MAX78000/AES/main.c
Outdated
@@ -45,6 +45,7 @@ | |||
#include "board.h" | |||
#include "dma.h" | |||
#include "aes.h" | |||
#include "aes_regs.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.
Not needed to include aes_regs.h file
aes.h file include it.
Examples/MAX32690/Flash/main.c
Outdated
@@ -47,6 +47,7 @@ | |||
#include "nvic_table.h" | |||
#include "flc.h" | |||
#include "icc.h" | |||
#include "flc_regs.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.
No need to include flc_regs.h file flc.h already include it.
Examples/MAX32690/DMA/main.c
Outdated
@@ -45,6 +45,7 @@ | |||
#include "mxc_device.h" | |||
#include "nvic_table.h" | |||
#include "dma.h" | |||
#include "dma_regs.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.
No need to include dma_regs.h file dma.h already include it.
@@ -45,6 +45,7 @@ | |||
#include "mxc_device.h" | |||
#include "nvic_table.h" | |||
#include "dma.h" | |||
#include "dma_regs.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.
No need to include dma_regs.h file. dma.h already include it.
Examples/MAX78002/AES/main.c
Outdated
@@ -45,6 +45,7 @@ | |||
#include "board.h" | |||
#include "dma.h" | |||
#include "aes.h" | |||
#include "aes_regs.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.
No need to include aes_regs.h file.
Examples/MAX78002/DMA/main.c
Outdated
@@ -45,6 +45,7 @@ | |||
#include "mxc_device.h" | |||
#include "nvic_table.h" | |||
#include "dma.h" | |||
#include "dma_regs.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.
no needed include.
Examples/MAX78002/Flash/main.c
Outdated
@@ -47,6 +47,7 @@ | |||
#include "nvic_table.h" | |||
#include "flc.h" | |||
#include "icc.h" | |||
#include "flc_regs.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.
Same as above.
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.
Unneeded code lines and includes should not be added
The example functionality shall not be change as possible as.
8cfcc0b
to
cabb35b
Compare
Standardize return message and value for single shot ones Signed-off-by: Sadik.Ozer <sadik.ozer@analog.com>
cabb35b
to
18a33e1
Compare
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.
Related changes has been applied.
@Jake-Carter Could it be merged as soon as possible? |
@ozersa Of course, just merged |
@karaanil Continuation of #218