No problem getting power_manager_rtos_demo_mqx running on a FRDM-KL43Z board, but when I try to use an mqx-lite configuration it crashes (jumps to the Reset Handler). To get it to build, I removed references to the mqx_stdlib and changed MQX_COMMON_CONFIG to MQX_LITE_CONFIG in mqx_sdk_config.h. In main.c, I also had to bypass the ioctl call that disabled the stdin echo flag. I guess mqx-lite doesn't have ioctl?
Any thoughts?
My ultimate goal is to get the mower manager demo running under mqx-lite on a FRDM-KL27 board, but there's no demo project for the KL27 except bare metal.
I've attached a zip file containing the project for the FRDM-KL43Z. I've changed main.c and created a power_manager_rtos_demo_mqx-lite directory. I use IAR for my projects.
Original Attachment has been moved to: power_manager_rtos_demo.zip
Hi Mark,
Can you post your project so others contribute?
Regards,
David
I've attached a zip file to my original post....
Hi Mark,
I think there might be confusion as to what RTOS is running with the KL43 example/demo projects.
If the folder name says MQX...it should be MQXLite RTOS that is used since Kinetis L devices are not supported by MQX but only MQXLite.
So in your case you shouldn't have needed to make any changes to the C:\Freescale\KSDK_1.2.0\examples\frdmkl43z\demo_apps\power_manager_rtos_demo\power_manager_rtos_demo_mqx\kds project.
Regards,
David
David,
You'll find that the Kinetis L devices (we use the FRDM-KL43 and -KL27 boards for our initial development) can run both MQX and MQXLite. I know this because I've run a variety of the example projects with both. Mostly, all I needed to do was change MQX_COMMON_CONFIG from MQX_SMALL_RAM_CONFIG to MQX_LITE_CONFIG. Most of the time, main.c was written to handle either, with compiler switches to use main() rather than Main_Task() and other differences.
Having said that...
The out-of-the-box power_manager_rtos_demo_mqx uses MQX and works fine. When I try to build it with MQXLite it builds fine but crashes when I run it. If you - or anyone - has this demo running MQXLite on either board, I'd love to see it.
Thanks,
Mark
Hi Mark,
I got additional verification you are correct and I just had missed the update that full MQX could be run on the Kinetis L devices with sufficient memory.
I've been on PTO much of the week and fighting email back log but will continue to dig into this issue of switching a MQX enabled example to a MQXLite example.
Regards,
David
Thanks, David, I appreciate the effort!
Mark
Hi Mark,
Here is an update. I have other that are going to help look at this too.
Summary: Simple new projects that are created using KSDK+PE can switch between MQX and MQXLite as mentioned below.
With the non-PE example that is MQX based and links in various MQX Libraries, I'm partially successful but not fully yet.
Regards,
David
NOTES:
I ran the following test:
Add code so they both just to a printf to terminal.
Now to swap them so the frdmk64f_pe_mqx now becomes mqxLite. fsl_debug_console gets added to project, have to update which UART pins to use and plug in 115200 baud. Re-generate code.
Only error was a couple of #includes needed to be commented out in the rtos_main_task.c
//DES commented out when converting MQX to MQXLite #include "uart1.h"
#include "fsl_mpu1.h"
#include "fsl_hwtimer1.h"
//DES commented out when converting MQX to MQXLite #include "MainTask.h"
#include "Task1.h"
Now to swap the frdmk64f_pe_mqxLite to become mqx. fsl_debug_console gets automatically disabled.
Had to update baud and pins (I think). Re-generate code.
Compiled clean.
For both, a couple of screens popped up to indicate what files were to be deleted and/or added by PE and I just clicked OK.
Summary: To change a simple project from MQX to MQXLite or visa versa wasn’t just a click but it wasn’t to painful either.
Follow-up….maybe there is a difference between frdmk64f and frdmkl43z implementation????
Maybe a more complicated project like the power_managr_rtos_demo causes additional issues? I did
Differences between newly created projects and the power_manager…. The newly created has all code in the project where power_manager app is linking to different mqx libraries.
Now playing with power_manager_rtos_demo_mqx application:
I’m finding that there are tweaks needed.
First and foremost you need to re-compile the libraries after changing the MQX_COMMON_CONFIG (yes it should be widely known but still getting used to KSDK MQX so I stumbled on this point).
There is information in the main.c to make changes to the Properties of the power_manager_rtos_mqx_frdmk64f:
/************************* Configure for MQX************************************/
#if (defined FSL_RTOS_MQX)&&(MQX_COMMON_CONFIG == MQX_LITE_CONFIG)
#if MQX_STDIO
#error "MQX Lite configuration is designed to work with tool provided STD Library.\
Remove reference to MQX STD library from your build tool project options:\
IAR:\
Linker->Library->aditional_libraries - remove lib_mqx_stdlib.a path \
C/C++ Compiler->Preprocessor->Additional include directories: - remove mqx_stdlib \
\
KEIL: \
Linker->Misc controls - remove lib_mqx_stdlib.lib path \
C/C++->Include Paths - remove mqx_stdlib \
\
KDS: \
C/C++ Build\Settings->Cross ARM C Linker\Miscellaneous - remove lib_mqx_stdlib.a path\
C/C++ Build\Settings->Cross ARM C Compiler\Includes - remove mqx_stdlib (on 4th line)\
\
Atollic: \
C/C++ Build\Settings->C Linker/Libraries->Librarie search path - remove lib_mqx_stdlib \
C/C++ Build\Settings->C Compiler/Directories->Include Paths - remove mqx_stdlib \
CMAKE : \
Remove following lines from CMakeList.txt: \
INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/mqx/lib/twrk22f120m.armgcc/debug/mqx_stdlib) \
INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/mqx/lib/twrk22f120m.armgcc/release/mqx_stdlib) \
\
TARGET_LINK_LIBRARIES(lpm_rtos_mqx ${ProjDirPath}/../../../../../rtos/mqx/lib/twrk22f120m.armgcc/debug/mqx_stdlib/lib_mqx_stdlib.a) \
TARGET_LINK_LIBRARIES(lpm_rtos_mqx ${ProjDirPath}/../../../../../rtos/mqx/lib/twrk22f120m.armgcc/release/mqx_stdlib/lib_mqx_stdlib.a) \
."
#endif /* MQX_STDIO */
After doing this I could compile but it crapped out in the following IOCT call:
#if (defined FSL_RTOS_MQX) && (MQX_COMMON_CONFIG != MQX_LITE_CONFIG) //DES??? If configure to MQXLite should this execute too? ...testing by adding "&& (MQX_COMMON_CONFIG != MQX_LITE_CONFIG)"
// In deffault, MQX enables echo flag for stdin.
// For power manager demo, disable MQX flag to doesn't echo character.
ioctl( 0, IOCTL_NIO_TTY_SET_FLAGS, NIO_TTY_FLAGS_EOL_RN); // 0 - stdin
#endif
So I just changed it (as shown) so the call wouldn’t happen. Now I see terminal output but when the code to receive a character is called from getInput() the UART_DRV_ReceiveDataBlocking() function never returns.
EDITed:
Ok..I found a bug in the frdmk64f board.h.
Make this change and now my power_manager_rtos_demo_mqx_frdmk64f that was MQX OS is now running as MQXLite.
#define PM_DBG_UART_IRQn UART0_RX_TX_IRQn | //DES was UART1_RX_TX_IRQn |
More later...
Ok...its later.
I was able to make the above changes to the power_manager_rtos_demo_mqx_frdmkl43z (a MQX application) to convert it into a MQXLite application.
I saw the issue of resetting that Mark had though. I kept stepping into the code trying to find where it was breaking but found that if I stepped far enough, I could then run successfully to see the demo operate on the terminal. But is a VLLSx was executed then it would freeze again. POR and button reset would not get the app running. I would have to step into the scheduler and then past the dispatch.S sched_internal label, I could run.
I have found a workaround that seems stable but I will have to ask the Kinetis L and MQX team respectively to give it a formal blessing.
WORKAROUND which keeps interrupts disabled until scheduler enables it later:
Open the mqx_frdmkl43z_all->PSP_Cortex->dispatch.S file.
/* set PSP = MSP */
mrs r0, MSP
msr PSP, r0
cpsie.n i */ /* enable interruprs */
Comment out line 102....it looks like the following.
/* set PSP = MSP */
mrs r0, MSP
msr PSP, r0
/* //DES commented out as a test 19-June-2015 cpsie.n i */ /* enable interruprs */
Obviously re-compile library and then application and now it should run in debugger and from POR or switch reset.
Regards,
David