Everything you always wanted to know about Eclipse, Embedded Systems Programming, Software and Tools, or any topics of this blog, but where afraid to ask, then this page is for you.
Post a comment, and you might get an answer, either from myself or from the readers of this blog. Otherwise: the answer is always ‘42‘ 😉
For feature requests or bug reports on the McuOnEclipse project end Processor Expert components, you should use the GitHub issue tracking system:
- McuOnEclipse Processor Expert components: https://github.com/ErichStyger/McuOnEclipse_PEx/issues
- McuOneEclipse example projects: https://github.com/ErichStyger/mcuoneclipse/issues
Hi Erich! great work on his blog ! I’ll use some of your code inside my project ! Quick question about the freeRTOS PE component. I seem to get lost with the priority scheme of freeRTOS, interrupt and your implementation of the freeRTOS component.
I want to be sure of one thing : IDLE task is assigned priotity 0, I guess it’S the lowest priority, the priority we give in FRTOS1_xTaskCreate() (PE component) should be related to priority number of the free RTOS right ? not the priority of the interrupt.. which are inverted right ?
lets says i create 2 tasks with your component :
FRTOS1_xTaskCreate(tsk1, “Task1”, configMINIMAL_STACK_SIZE, &globalhost, 1, NULL);
FRTOS1_xTaskCreate(tsk2, “Task2”, configMINIMAL_STACK_SIZE, &globalhost, 2, NULL);
Task2 priority will be greater than Task1 ?
sincerely.
LikeLike
Hi Etienne,
the FreeRTOS component is using the normal FreeRTOS priority scheme (nothing different). If you are new to FreeRTOS and the ARM Cortex interrupts, then I recommend that you have a read at the multipart tutorial starting at https://mcuoneclipse.com/2016/08/14/arm-cortex-m-interrupts-and-freertos-part-1/.
Keep in mind that FreeRTOS priorities start with zero as the lowest priority, while the ARM Cortex priorities have zero as the highest urgency level.
So yes, 0 (or tskIDLE_PRIORITY) is the FreeRTOS priority for the IDLE task. The RTOS itself runs with its interrupts (SysTick, PendSV and PendSvReq) at the lowest interrupt priority (15 for 4 priority bits).
And yes, for your example, the Task2 his higher urgency than Task1 and this one has higher urgency than the IDLE task.
I hope this helps,
Erich
LikeLike
Hello, Erich! I really ensjoy your blog!
I have a question about mbed, especially openSDA.
I build a board based on FRDM-KL43Z.
My trouble is my boards are doesn’t work in my PC. I think absent of bootloader is main problem. Can you teach me how install a new bootloader in a board? There is none-S/W in my board.
Here is my board symptom.
1. Power LED is working
2. MCU USB port ack as USB serial. But it cannot use as storage.
3. openSDA USB unack.
sincerely,
Soo-Chang
LikeLike
Hi Soo-Chang,
have a read at https://mcuoneclipse.com/2014/11/01/illustrated-step-by-step-instructions-updating-the-freescale-freedom-board-firmware/ how to update the bootloader/application.
If you are using Windows 8 or 10, then have a read at https://mcuoneclipse.com/2016/08/01/bricking_and_recovering_opensda_boards_in_windows_8_and_10/ too.
I hope this helps,
Erich
LikeLike
Hello again.
I tried your guide. But it is different situation.
My board flash is empty. So it doesen’t work as a writable device.
Anyway I really appreciate of your advice again.
sincerely Soo-Chang
LikeLike
Your openSDA/K20 is programmed, right? It does not matter if your KL43Z is empty or not: the K20 will programm it, no matter what.
LikeLike
Actually, I’m not sure about that. I made my own PCB based on KL43Z. I used new K20. I think OpenSDA/K20 is not programmed as well. I don’t have any S/W in my board.
I think the only way to install the bootloader is using jtag.
LikeLike
Ah, I see, I thought you are talking about the FRDM-KL43Z. So yes, if you have a board with a new K20DX128 chip, you need to program it first with the bootloader. E.g. in a way described in https://mcuoneclipse.com/2016/06/26/how-to-recover-the-opensda-v2-x-bootloader/
LikeLike
Thank you, Erich!
I will follow your advice. Thankyou again!
I will update my data later.
P.S. Happy new year!
LikeLike
Hi…in my case my boards are doesn’t work in my PC. I think absent of bootloader is main problem. Can you teach me how install a new bootloader in a board? There is none-S/W in my board.
LikeLike
That depends on the board. Which board are you using? Otherwise have a read at https://mcuoneclipse.com/2014/11/01/illustrated-step-by-step-instructions-updating-the-freescale-freedom-board-firmware/
I hope this helps,
Erich
LikeLike
Hi Erich,
I just noticed that NXP has a Low Voltage Hbridge PE component (LVHBridge) , and also a medium voltage Hbridge (MVHBridge) component that can be downloaded and work on processors like the K20’s with Processor Expert. Have you seen these before and do you have any experience with them?
I found it because I want to make a stepper motor driver (microstepping) using discrete components on the theory that it could be better/cheaper than using a microstepping chip- these components look like the easy way to do so.
Brynn
LikeLike
I have no experience with these components.
LikeLike
Hi Erich,
I am working on a project where I send short text messages between a K64F and an android tablet. I want the K64F to be a host and the tablet to be a device. How do I do this. Do I need an OTG cable.
LikeLike
Hi Eli,
the means that the K64F needs to be in host mode. If you are using the FRDM-K64F board, then this is not supported out of the box. Basically you need to supply 5V from the board to the tablet. See https://mcuoneclipse.com/2012/10/15/usb-host-mode-hack-for-the-freedom-kl25z-board/ and https://mcuoneclipse.com/2013/03/02/usb-msd-host-for-the-freedom-board/. The bigger thing is that you need a USB CDC host implementation running on the K64F. I had this on my ‘wish list’ for a very long time, but never got to the point to have the USB stack working that way. You might need to check the latest NXP MCUXpresso SDK if it supports what you need?
LikeLike
Hi Erich
I am trying to modify your example using the Adafruit SPI friend. I want to use the Freedom K64F instead of the Tiny20.
For the Adafruit SPI you use 5 IO lines. I want to use the Adafruit UART friend, no interrupt and the CS tied to GND. This will use up only 2 IO lines.
Will this work?
Thanks
Eli
LikeLike
Using the K64F instead the K20 should be pretty straight forward. But there is no CS line on the UART friend (https://www.adafruit.com/product/2479)?
Keep in mind that for the UART friend you have to use UART hardware flow control, and not every UART peripheral might support that. From that perspective, the SPI BLE Friend is much easier to use imho.
LikeLike
Hi Erich,
Great website ! I found the site not too long ago ! You seem like a person who loves these works and want to teach others as well!
I have been struggling to learn embedded electronics but what I have discovered missing is a complete guideline from beginner to expert. If you could write an article on where to start and how to grow from there would benefit many beginners like me I believe.
Thanks
Mark
LikeLike
Hi Mark,
thank you for that feedback and suggestion. My suggestions would be to look first for some of the older articles (as they are more beginner like). And what would you define as tha ‘beginners knowledge’ to build upon?
LikeLike
First, thanks for the quick response. I would say a beginners knowledge is basic knowledge of programming in C, some familiarity with electronic components and someone with enough knowledge to play around with arduino or similar platform. For example, right now I find programming in arduino or in mbed online compiler fairly easy as they hide many details. Also there are a lot of tutorial for them available online as well. But when I dive under the hood,I don’t know where to begin with.
Mark
LikeLike
Hi Mark,
maybe have a look at tutorials like these:
https://mcuoneclipse.com/2016/03/13/tutorial-blinky-with-the-frdm-kl27z-and-kinetis-sdk-v2/
https://mcuoneclipse.com/2016/05/20/tutorial-blinky-with-nxp-kinetis-sdk-v2-0-and-processor-expert/
https://mcuoneclipse.com/2017/05/13/mcuxpresso-ide-blinky-the-nxp-lpc800-dip-board/
Erich
LikeLike
Perfect ! Thanks a lot for taking your time to find the links for me!
Have a great day !
Mark
LikeLike
Hi Erich,
So I was trying to do the DIY USB joystick but I keep getting this error: “Description Resource Path Location Type
Generator: FAILURE: at line 10: Property not found: “TxBuffer” (file: Drivers\Common\FSL_USB_HID_Joystick_DeviceSettings.Inc) FRDM-KL25Z_USB_HID_Joystick HIDJ1 Processor Expert Problem”
Can you help me please?
LikeLike
Hi,
I suggest that you post that question directly to the article you are using? Are you using my project from GitHub (which one)?
But it seems to me that you did not assign a ring buffer to the USB component?
LikeLike
I was trying to comment on that post but it says sorry can’t post :(. It’s the project from Github and the tutorial is on this site too. https://mcuoneclipse.com/2017/06/04/diy-usb-hid-joystick-device-and-game-controller/
LikeLike
It let me comment on the tutorial now :).
LikeLike
Hi again
I have an android tablet talking to a K64F using the Adafruit LE uart. However it will not send more that 20 bytes at a time.Is there a way to increase this limit.
Thanks
LikeLike
You have to implement message fragmentation (sending larger chunk of data with multiple messages). The BLE protocol is optimized for low power and small amount of data, you cannot send more than this 20 bytes in a a single message.
LikeLike
Hi Eric,
Great work. Really appreciate your insights. Had a question. Is it possible to shutdown a cortex m4? I understand the CPU can be configured to go in Stop Mode or Sleep Mode, but is it possible to to initiate a shutdown from software? I don’t think it is possible as I cannot find any register set that lets me perform such an action, but wanted to run it by you as well
Thanks again
LikeLike
apologies for misspelling your name. I meant to type Erich
LikeLike
No worries, both variants work very well 🙂
LikeLike
You can reset any M3/M4/M7 using the approach described in https://mcuoneclipse.com/2015/07/01/how-to-reset-an-arm-cortex-m-with-software/. But this will be a reset/restart.
If you want to do a ‘shutdown’ as on the PC then could either go into deep sleep mode or do a reset and right after that go into deep sleep.
LikeLike
yep. that’s what I had in mind as well. Thanks soo much. Once again, a great website and great resources.
LikeLike
Hello Erich,
First of all I would like to thank you for the awesome work and for the effort you have put into these tutorials. I have the following question. I ordered the product FRDM-K64F-AGM01, which consists of a shield and a development board. From the pictures at NXP site, I infered that the sensor shield board would be removable and that I could use the FRDM-K64F standalone. The problem is I can’t remove the shield (if I apply more pressure, I am scared that I will break the board). Do you know if it is supposed to not be removed?
Thanks in advance,
Panagiotis
LikeLike
It should be removable. I don’t have that kit, but from the pictures it really should be removable. You should be able to tell this with having a close look at the headers: ther must be a black (high) black row of female headers on the FRDM-K64F board, with a row of male pin headers on the AGM01 board. Try to lift the board carefully on one end, then on the ohter, and so on.
I hope this helps,
Erich
LikeLike
Hello Erich ,
I have to configure a common SPI bus to be used for two different SP clock frequency 2MHz and 8MHz on K10 series controller. I am using SPIMaster_LDD component in processor expert V10.4.0T.The method SetClockConfiguration() is appear as disabled . How can I enabled it and select the generate code option. Please explain .
Thanks and Regards,
Rohit K.
LikeLike
Hi Rohit,
You have to use the SelectConfiguration() (not SetClockConfiguration()) method. Have a read in https://mcuoneclipse.com/2014/05/26/tutorial-data-logger-with-the-frdm-k64f-board/ and search for SelectConfiguration. In the clock rate configuration of the component you have to use ‘list of values’.
I hope this helps,
Erich
LikeLike
Thank you Erich.
LikeLike
Hi Erich,
In the clock rate configuration of the component i have used ‘list of values’.
In value type , I am using mode 0 and mode 1.
I am setting following the values : mode 0 = 0.125µsec and mode 1= 0.5µsec.
When I reopen the clock rate configuration window , I observed that mode 1 value that I was set is not there. Mode 1 shows the same value as mode 0.
Can you please let me know why this is happening?
Thanks and Regards,
Rohit K.
LikeLike
Hi Rohit,
not sure what is causing this. I assume you have pressed the OK button? The other thing is: have you picked the values from the ‘Possible settings’ list (e.g. double-clicking on the value)? If the value you have entered is not part of that list, it will not be applied.
I hope this helps,
Erich
LikeLike
Hello, Erich,
im thinking about trying to do a firmware update over the air with delta file optimization. Do you something about that? An elipse configuration which does not change all the file over the smallest change in code, maybe?
Regards,
Morais D.
LikeLike
Yes, I have done something like this where we are updating the firmware of a small satellite in space. But this was a customer paid project so it is not available to the public.
LikeLike
Do you can provide some tips about this subject? Off course, that isn’t specific with this project and does not violate, in any way, your relation with the costumer.
Regards,
Morais D.
LikeLike
Here are a few ideas:
– use dedicated linker sections to separate functions/files, e.g. https://mcuoneclipse.com/2014/10/06/putting-code-of-files-into-special-section-with-the-gnu-linker/
– keep deltas between firmware versions small
– create delta files for the firmware update, write your own tool to create the delta or use programs like Srecord (from SourceForge)
– use a simple compression scheme, e.g. Run-Length-Encoding
– pack everything into a communication protocol suitable for the above
I hope this helps 🙂
Erich
LikeLike
That helps a lot, thank you one more time!
Regards,
Morais D.
LikeLike
Hi Erich,
Happy New Year 2019.
I was looking for some examples for ARM Cortex-M33 with TrustZone and FPU. I couldn’t find any articles on Cortex-M33 here. It is a relatively new ARM core and firmware development on Cortex-M33 is still in nascent stages. Can you please consider writing about it in your next blog?
Thanks
Radhika.
LikeLike
Hi Radhika,
thanks, Happy New Year to you too!
Yes, Cortex-M33 is on my radar, but because I have not ordered or used any of these in my projects, I have not written any articles about it. I’ll have to see if one of the university research projects starting next semester could benefit from a M33, and then certainly I will come up with an article about it.
LikeLike
Hi Erich,
Any idea why the MK20DX128xx5 is not supported in the MCUXpresso IDE? they only seem to have an SDK file for the parts ending in 10 (e.g. MK20DX128xx10).
Thanks
LikeLike
No real idea. But I think it is maybe because this was one of the very first Kinetis devices, so it seems NXP has left it behind from the SDK point of view. The FRDM-K20 board for it is not available any more too.
But we are using the MK20DX128x5 in many of our designs, and that’s why we continue to use Processor Expert because it is supported with it.
LikeLike
Hello Erich,
i have a problem with a new FRDM-KV31F board; one time attached to PC with Windows 10 (home), i think have bricked the board-bootloader. Now, the board is unresponsive.
Also i have read your severals tutorials about resolve it, (in effect i have resolved this identical problem with an FRDM-K66F board), but with the kv31f my probe is not able to program the flash of k20dx128 interface chip, i receive an error message (i dont understand why, the chip is identical to interface-chip of frdm-k66f… or not?!)
my conditions: pc Windows 10, IDE MCUXpresso 10.3.1, probe usb Multilink of PEMicro.
LikeLike
I don’t know the FRDM-KV31F, but if it is similar to the FRDM-KL25Z, then you cannnot reprogram the chip with a debugger as the flash is protected with mass erase disabled.
But that would be good, as then Windows will not be able to brick the board. Can you try accessing it from a Windows 7 (native, not VM) machine?
Then you should be able to update the P&E bootloader and load the application again.
LikeLike
Hi…your openSDA/K20 is programmed, right? It does not matter if your KL43Z is empty or not: the K20 will programm it, no matter what.
LikeLike
Not sure if I can follow…. But: on the FRDM-KL43Z board the OpenSDA/K30 is programmed, so you can use it to program the KL43Z.
LikeLike
Hi Erich / All,
Any idea how to fix the folllowing error in KDS?
“Unable to read repository at http://gnuarmeclipse.sourceforge.net/updates/content.xml.
Connection reset”
LikeLike
To my understanding this has something to do with the increased SourceForge security settings. The Eclipse version in KDS is simply too old to cope with that.
What I do and recommend is downloading the package/plugins (https://gnu-mcu-eclipse.github.io/plugins/download/) and install them with Add New Software from the archive package.
LikeLike
Hi Erich,
I downloaded the latest release form here:
https://github.com/gnu-mcu-eclipse/eclipse-plugins/releases/tag/v4.5.1-201901011632
Selected Help->Install New Software….->Add…->Archive->ilg.gnumcueclipse.repository-4.5.1-201901011632.zip
and selected the following
GNU MCU C/C++ ARM Cross Compiler
GNU MCU C/C++ Freescale Project Templates
GNU MCU C/C++ J-Link Debugging
GNU MCU C/C++ OpenOCD Debugging
But this still results in a fail, any ideas?
LikeLike
Hi Erich,
I also have the folloing error when updating MCUXpresso IDE v11.0.0_2516:
“Unable to read repository at http://mcuxpresso.nxp.com/staticdata/updates/kex_ide_6.0/content.xml”
Have you seen this before?
LikeLike
I just tried that update, and it works on my side.
I have seen such error and others have reported similar things, and they were caused by bad network connection, the repository down/not accessible or problems with firewalls which interrupt the connection all the time.
LikeLike
Is that for KDS? I remember that because the IDE is rather old, the newest plugins do not work.
I belive I have the following installed: ilg.gnuarmeclipse.repository-3.3.1-201702251311
LikeLike
Hi Erich,
Thanks for the reply:
i have V3.4.1 working, looks like V4 or newer will not work 😦
https://github.com/gnu-mcu-eclipse/eclipse-plugins/releases/tag/v3.4.1-201704251808
I still find it strange that NXP will not include the MK20 in the MCUXpresso version
LikeLike
About the K20 in the SDK: that K20 was one of the very first ARM Cortex-M4 Freescale implemented. I think they want you to use the newer devices in your designs.
LikeLike
Hi Erich,
Any idea where i can find the recommended footprint for the MK22FN256VLH12 (yet another thing NXP/Freescale make difficult)?
Thanks
LikeLike
Hi Andy,
I usually check at Mouser (https://www.mouser.ch/ProductDetail/NXP-Freescale/MK22FN256VLH12?qs=y0HsvvugQ44TVl0TxxK8RQ==) they to provide a footprint conversion/tool.
There is as well https://mcuoneclipse.com/2015/06/30/freescale-kinetis-cad-footprints-and-symbols-for-eaglealtiumetc/ but I have not used that for years, not sure if this still active.
LikeLike
Hi Erich,
Just started using the MCUXpresso IDE with the MK22FN512xxx12, and noticed with an empty project (with just a while loop) 12.5% of the RAM is being used any ideas?
Memory region Used Size Region Size %age Used
PROGRAM_FLASH: 2424 B 512 KB 0.46%
SRAM_UPPER: 8196 B 64 KB 12.51%
SRAM_LOWER: 0 GB 64 KB 0.00%
text data bss dec hex filename
2420 4 8192 10616 2978 MK22FN512xxx12_Project.axf
LikeLike
Hi,
I am guessing this is the stack + heap? 8K seems high, where is this changed?
LikeLike
Project > Properties > C/C++ Build > Settings > Tool Settings > MCU Linker > Managed Linker Script there you find the size allocated for Heap and Stack
LikeLike
By default the SDK project allocates 4K RAM for heap and stack each.
LikeLike
Hi Erich,
Does the KDS USB CDC Lib support the following:
Clear To Send – CTS
Data Set Ready – DSR
Data Carrier Detected – DCD
I need to enable / disable the above serial port inputs
Thanks
LikeLike
Hi Andy,
yes, my Processor Expert USB CDC port does support this.
I’m using this for things like I have done in https://mcuoneclipse.com/2019/08/18/building-and-flashing-esp32-applications-with-eclipse/
LikeLike
Hi Erich,
Sorry should have been more clear.
I am using the MK20DX128xxx5 device and the USB CDC library, such that the MK20 is enumerated as a virtual com port.
i need the MK20 to enable / disable CTS, DSR and DCD, such that the host (connected PC) sees the virtual lines go on / off
Clear To Send – CTS
Data Set Ready – DSR
Data Carrier Detected – DCD
LikeLike
Basically i have on old program running on the PC that connects to a Com port and uses the CTS, DSR and DCD lines to activate various parts of the program.
I have 3 buttons connected to the MK20 and would like each to enable / disable the virtual CTS, DSR and DCD lines.
LikeLike
From the USB side this is handled with the ‘Line Change Event’. The USB component uses the following callback which passes the two bits: CDC1_OnLineStateChanged(). See as well http://markdingst.blogspot.com/2014/06/implementing-usb-communication-device.html
LikeLike
Hi Erich,
Thanks for your reply, i cannot find a method in your CDC wrapper that will do this. Should i be looking at the following function in the usb_cdc_pstn.h?
extern uint_8 USB_Class_CDC_PSTN_Set_Ctrl_Line_State (
uint_8 controller_ID,
USB_SETUP_STRUCT * setup_packet,
uint_8_ptr *data,
USB_PACKET_SIZE *size);
i have the USB CDC working just tring to figure out how i change the state of the virtual lines:
void CDC_Run(void) {
for(;;) {
if(CDC1_App_Task(cdc_buffer, sizeof(cdc_buffer)) == ERR_BUSOFF) {
/* device not enumerated */
WAIT1_Waitms(10);
} else {
SEGGER_RTT_WriteString(0, “Change line state:\r\n”);
int key = SEGGER_RTT_WaitKey();
switch(key) {
case ‘1’:
SEGGER_RTT_WriteString(0, “CTS Enabled\r\n”);
// TODO – Enable USB CDC CTC virtual line
break;
case ‘2’:
SEGGER_RTT_WriteString(0, “CTS Disabled\r\n”);
// TODO – Disable USB CDC CTC virtual line
break;
case ‘3’:
SEGGER_RTT_WriteString(0, “DSR Enabled\r\n”);
// TODO – Enable USB CDC DSR virtual line
break;
case ‘4’:
SEGGER_RTT_WriteString(0, “DSR Disabled\r\n”);
// TODO – Disable USB CDC DSR virtual line
break;
case ‘5’:
SEGGER_RTT_WriteString(0, “DCD Enabled\r\n”);
// TODO – Enable USB CDC DCD virtual line
break;
case ‘6’:
SEGGER_RTT_WriteString(0, “DCD Disabled\r\n”);
// TODO – Disable USB CDC DCD virtual line
break;
default:
SEGGER_RTT_WriteString(0, “Unknown command\r\n”);
break;
}
}
}
}
LikeLike
I assume you are using my latest component relase from SourceForge from July 18th 2019 (https://sourceforge.net/projects/mcuoneclipse/)?
You will find it in the events for the CDC component. The hook is called for control line changes by the host.
LikeLike
Hi Erich,
Yes i have the latest lib and have added the CDC1_OnLineStateChanged event, and i am using the latest FSL_SUB_Stack.
But I am not trying to monitor the Host lines, which would be DTR and RTS.
I am trying to Set the device lines which would be CTS, CD, DSR and RI.
So i was looking for somthing like CDC_Set_LineState(CTS);
Thanks,
Andy
LikeLike
Hi Andy,
I only had a need for getting the status from the host, so this is what I have added to the stack :-).
I have not implemented reporting the status to the host, but if you have a solution to contribute, I can integrate it into the Processor Expert component?
LikeLike
Hi Erich,
After looking into it, i think getting the control lines working may require a driver change. So i am going to put down an FTDi device which supports the control lines i need and cahgne the MK20 to an MK10 as the USB will no longer be needed.
Thanks,
Andy
LikeLike
Hi Erich,
I have a building problem again with my project. The error follows.
Linker CRP Enabled, but no CRP_WORD provided within application.
I don’t know what it means. Furthermore, I have linked the project with right paths and there is no other library I should put on the “MCU Linker”.
Thanks for your attention.
Best regards,
Mike
LikeLike
PS: My MCU is LPC845 and I use MCUXPresso IDE to build it.
Mike
LikeLike
Hi Mike,
Never seen that one, but found this one.
http://www.support.code-red-tech.com/CodeRedWiki/CRP_LinkError
Maybe this helps?
Erich
LikeLike
Hi Erich,
I really appreciate your advice. The weird problem has been solved. However, it seems that the problem is associated with RAM\Flash protection. I don’t know whether there will be serious problem to the memory as I try to use the IAP function for this chip.
Anyway, thanks for your prompt attention! You always solve my problem when I am in need!
Mike
LikeLike
>>I don’t know whether there will be serious problem to the memory as I try to use the IAP function for this chip.
Well, if you are playing with the flash protection features, you need to be prepared that you brick your device by accident.
LikeLike
Hi Erich,
Quick USB CDC question:
If CDC1_SendString((unsigned char*)”Some Text”); is called but the com port is closed the stack gets stuck.
Is there a function to call that checks if the CDC port is open and read to send?
LikeLike
You can use CDC1_ApplicationStarted() for this.
On top of that, you can enable ‘Use Timout’ in the CDC component properties.
LikeLike
Hi Erich
I am using MCUXpresso IDE v11.0.0 [Build 2516] [2019-06-05]
I incorporated SDK_2.6.0_FRDM-K64F
Using Import SDK examples, all the examples are bm, why
When I start a new project, the only option for the Operating System is “baremetal”
How can I add FreeRTOS?
LikeLike
When you have built the SDK on the MCUXpresso web site, have you included FreeRTOS or not? If you did not include FreeRTOS, you get no examples or support for it.
LikeLike
Hi again
I am using MCUXpresso IDE v11.0.0 [Build 2516] [2019-06-05] and communicating with Tera Term.
I imported the example frdmk64f_freertos_uart.
The introduction message has garbled characters towards the end.
Only when I lowered the baud rate to 9600, the message is displayed correctly.
Is that a problem with the UART_RTOS_Send routine?
LikeLike
You have to check at which baud the UART is configured. If you have configured the UART with the correct baud, you probably have not configured the system clock correclty, as the baud depends on it.
LikeLike
Hi Erich,
I’m using MCUXpresso 11.01 for the MIMXRT1062DVJ6A, MCUXpresso SDK USB Stack, Rev. 10, 06/2019, and the MCUXpressio usb_example program host_cdc_bm, which I modified to use FreeRTOS. The data traffic to and from my CDC device is managed in the context of the USB_HostCdcTask handler for the kUSB_HostCdcRunIdle state. Data transmission to my USB device works just fine when I call USB_HostCdcDataSend. But when I call USB_HostCdcDataRecv, my USB device can’t respond because the host cannot receive data (IN-NAK, according to the Beagle USB Analyzer and DataCenter). What might I have missed?
LikeLike
I have not used USB CDC on that i.MX RT, so cannot say much. I would have to try it myself first. But is there an example whithout FreeRTOS in the SDK which works? Just if this would the issue?
LikeLike
Thanks for the response. I actually did try this with the bare metal example and got the same result. However, I just now resolved the problem. I though that I didn’t need to use hardware flow control, but I was. Setting USB_HOST_UART_SUPPORT_HW_FLOW to 1 resolved the issue.
LikeLike
Thank you for providing the solution, very useful for me when I will try this myself 🙂
LikeLike
Hi Erich,
sorry, not sure if this belongs here but I am having a problem with my newly purchased J-Link EDU. I can somewhat debug my K64F with it through MCUXpresso however I am unable to use any utilities provided by SEGGER such as JLinkRTTViewer or even JLinkGDBServer. When I try to run any of these from command line (using Ubuntu based Linux distro) I get the following error message:
LOG: J-Link RTT Viewer V6.54: Logging started.
LOG: Connecting to J-Link via USB…
LOG: Device “MK64FN1M0XXX12” selected.
LOG: InitTarget()
LOG: Protection bytes in flash at addr. 0x400 – 0x40F indicate that readout protection is set.
For debugger connection the device needs to be unsecured.
Note: Unsecuring will trigger a mass erase of the internal flash.
LOG: Device will be unsecured now.
LOG: Timeout while unsecuring device. Erase never stops.
LOG: TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFFFFFFFFFF1
LOG: InitTarget()
LOG: Protection bytes in flash at addr. 0x400 – 0x40F indicate that readout protection is set.
For debugger connection the device needs to be unsecured.
Note: Unsecuring will trigger a mass erase of the internal flash.
LOG: Device will be unsecured now.
LOG: Timeout while unsecuring device. Erase never stops.
LOG: TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFFFFFFFFFF1
ERROR: Could not connect to target device.
I have tried other K64s as well with same result.
I am quite new to embedded so would be grateful if you could shed some light on what is happening and how to solve this.
Thank you.
Zdenek
LikeLike
This seems to be a connection problem with your device. The message
LOG: Protection bytes in flash at addr. 0x400 – 0x40F indicate that readout protection is set.
indicates that it is reading back all 0xff (which happens for bad/wrong connection) or if the device is secured.
The entry
LOG: Device “MK64FN1M0XXX12” selected.
shows that your device is the correct one.
The entry
LOG: J-Link RTT Viewer V6.54: Logging started.
shows that you are using a recent version of the J-Link software. As youi say it works with the IDE: can you check and verify what the IDE is using? You will see a similar connection log on the Console view of Eclipse.
LikeLike
Hi Erich,
thanks for the quick response.
This is what I get in MCUXpresso 11
Executed SetRestartOnClose=1
[MCUXpresso Semihosting Telnet console for ‘Dev1_FreeRTOS JLink Debug’ started on port 36314 @ 127.0.0.1]
SEGGER J-Link GDB Server V6.54 – Terminal output channel
and in another console view
[01-11-2019 09:19:48] Executing Server: /usr/bin/JLinkGDBServerCLExe -nosilent -swoport 2334 -select USB=261000035 -telnetport 2335 -singlerun -endian little -noir -speed auto -port 2336 -vd -device MK64FN1M0xxx12 -if SWD -halt -reportuseraction
SEGGER J-Link GDB Server V6.54 Command Line Version
JLinkARM.dll V6.54 (DLL compiled Oct 28 2019 10:37:24)
Command line: -nosilent -swoport 2334 -select USB=261000035 -telnetport 2335 -singlerun -endian little -noir -speed auto -port 2336 -vd -device MK64FN1M0xxx12 -if SWD -halt -reportuseraction
—–GDB Server start settings—–
GDBInit file: none
GDB Server Listening port: 2336
SWO raw output listening port: 2334
Terminal I/O port: 2335
Accept remote connection: yes
Generate logfile: off
Verify download: on
Init regs on start: off
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
——J-Link related settings——
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
——Target related settings——
Target device: MK64FN1M0xxx12
Target interface: SWD
Target interface speed: auto
Target endian: little
Connecting to J-Link…
J-Link is connected.
Device “MK64FN1M0XXX12” selected.
Firmware: J-Link V11 compiled Aug 14 2019 16:21:09
Hardware: V11.00
S/N: 261000035
OEM: SEGGER-EDU
Feature(s): FlashBP, GDB
Checking target voltage…
Target voltage: 3.32 V
Listening on TCP/IP port 2336
Connecting to target…InitTarget()
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x001C0000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
InitTarget()
Found SW-DP with ID 0x2BA01477
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
Connected to target
Waiting for GDB connection…Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00003EF8 (Data = 0xF852F000)
Reading 64 bytes @ address 0x20000500
Read 4 bytes @ address 0x00002CDC (Data = 0xB085B480)
Reading 64 bytes @ address 0x200004C0
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00003EF8 (Data = 0xF852F000)
Reading 64 bytes @ address 0x20000500
Read 4 bytes @ address 0x00002CDC (Data = 0xB085B480)
Reading 64 bytes @ address 0x200004C0
Received monitor command: reset
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
AfterResetTarget()
Resetting target
Downloading 16080 bytes @ address 0x00000000 – Verified OK
Downloading 16080 bytes @ address 0x00003ED0 – Verified OK
Downloading 4880 bytes @ address 0x00007DA0 – Verified OK
Downloading 24 bytes @ address 0x000090B0 – Verified OK
J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match
Writing register (PC = 0x 1d4)
Read 4 bytes @ address 0x000001D4 (Data = 0xB672B510)
Reading 64 bytes @ address 0x00000880
Read 2 bytes @ address 0x000008AE (Data = 0xF005)
Read 2 bytes @ address 0x000008AE (Data = 0xF005)
Reading all registers
Read 4 bytes @ address 0x000001D4 (Data = 0xB672B510)
Read 2 bytes @ address 0x000008AE (Data = 0xF005)
Received monitor command: semihosting enable
Semi-hosting enabled (Handle on BKPT)
Received monitor command: exec SetRestartOnClose=1
Executed SetRestartOnClose=1
Received monitor command: reset
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
AfterResetTarget()
Resetting target
Setting breakpoint @ address 0x000008AE, Size = 2, BPHandle = 0x0001
Starting target CPU…
…Breakpoint reached @ address 0x000008AE
Reading all registers
Removing breakpoint @ address 0x000008AE, Size = 2
Read 4 bytes @ address 0x000008AE (Data = 0xFE33F005)
Starting target CPU…
Both are indicating the usage of JLink GDB server 6.54
LikeLike
Hi Erich.
Just tried to copy/paste the command mcuxpresso used to start the gdb server into cmdline and things started to work. I assume some of my configuration has been incorrect. Noticed that I was using JTAG instead of SWD (should I be using SWD?).
Another (maybe dumb) question: Is it possible to show PRINTF output over the K64USB or somehow via the J-Link? The project has been setup to redirect printfs to UART. Not sure if I can go back to semihosting and use console instead.
Thanks for your time.
LikeLike
Hi Zdenek,
yes, you *have* to use SWD, as the OpenSDA (K20) on the FRDM board only supports SWD and no JTAG.
You can redirect the printf() to whatever you like, you just have to provide the needed glue logic.
LikeLike
Hi all, maybe someone can help me with this,
I have a freedom board kl25z, using GDB PEMicro Interface Debugging with eclipse 2019-12. I am working on dac_adc_demo project in KSDK 1.3 (Kinetis SDK). The startup code for this project is in startup_MKL25Z4.S. I am trying to make the debugger stop at Reset_Handler in startup_MKL25Z4.S. So I can single step in the startup code. For the debug configuration Startup tab, I set breakpoint at Reset_Handler instead of main. When I debug the program (dac_adc_demo.elf) I keep getting this message:
“Break at address “0x4d0″ with no debug information available, or outside of program code.”
0x4d0 is the address of Reset_Handler. The Debug settings in Tool Settings is set Maximum(-g3) and -ggdb
The editor does not open up the startup_MKL25Z4.S and let single step through the startup code.
But if I set breakpoint at main, I can debug/step through the code just fine.
Any help would be much appreciate it, I am stuck on this for a while now.
Thanks in advance.
Anthony H.
LikeLike
Hi Anthony,
Does it work if you set manually a breakpoint in the startup code? If not, it might be a problem that somehow you have disabled debug information for the startup_MKL25Z4.S file?
Erich
LikeLike
I just tried the same with with a KL27Z board and KDS (project is on https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-KL27Z/FRDM-KL27Z_SDK), and this works with your use case. It should be very similar to your 2019-12 IDE, or I don’t think there should be any difference as the plugins are the same.
LikeLike
Erich,
I have turned on verbose for gnu assembler and linker.
OUTPUT OF GNU ASSEMBLER
Building file: ../startup/startup_MKL25Z4.S
Invoking: GNU ARM Cross Assembler
arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -x assembler-with-cpp -DCPU_MKL25Z128VLK4 -DDEBUG -DFRDM_KL25Z -DFREEDOM -v -MMD -MP -MF”startup/startup_MKL25Z4.d” -MT”startup/startup_MKL25Z4.o” -c -o “startup/startup_MKL25Z4.o” “../startup/startup_MKL25Z4.S”
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/src/gcc/configure –target=arm-none-eabi –prefix=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native –libexecdir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/lib –infodir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/share/doc/gcc-arm-none-eabi/info –mandir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/share/doc/gcc-arm-none-eabi/man –htmldir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/share/doc/gcc-arm-none-eabi/html –pdfdir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/share/doc/gcc-arm-none-eabi/pdf –enable-languages=c,c++ –enable-plugins –disable-decimal-float –disable-libffi –disable-libgomp –disable-libmudflap –disable-libquadmath –disable-libssp –disable-libstdcxx-pch –disable-nls –disable-shared –disable-threads –disable-tls –with-gnu-as –with-gnu-ld –with-newlib –with-headers=yes –with-python-dir=share/gcc-arm-none-eabi –with-sysroot=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/arm-none-eabi –build=x86_64-linux-gnu –host=x86_64-linux-gnu –with-gmp=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-mpfr=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-mpc=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-isl=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-libelf=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-host-libstdcxx=’-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm’ –with-pkgversion=’GNU Tools for Arm Embedded Processors 8-2019-q3-update’ –with-multilib-list=rmprofile
Thread model: single
gcc version 8.3.1 20190703 (release) [gcc-8-branch revision 273027] (GNU Tools for Arm Embedded Processors 8-2019-q3-update)
COLLECT_GCC_OPTIONS=’-mcpu=cortex-m0plus’ ‘-mthumb’ ‘-O0’ ‘-fmessage-length=0’ ‘-fsigned-char’ ‘-ffunction-sections’ ‘-fdata-sections’ ‘-g3’ ‘-D’ ‘CPU_MKL25Z128VLK4’ ‘-D’ ‘DEBUG’ ‘-D’ ‘FRDM_KL25Z’ ‘-D’ ‘FREEDOM’ ‘-v’ ‘-MMD’ ‘-MP’ ‘-MF’ ‘startup/startup_MKL25Z4.d’ ‘-MT’ ‘startup/startup_MKL25Z4.o’ ‘-c’ ‘-o’ ‘startup/startup_MKL25Z4.o’ ‘-mfloat-abi=soft’ ‘-march=armv6s-m’
/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/cc1 -E -lang-asm -quiet -v -imultilib thumb/v6-m/nofp -iprefix /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/ -isysroot /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi -MMD startup/startup_MKL25Z4.d -MF startup/startup_MKL25Z4.d -MP -MT startup/startup_MKL25Z4.o -dD -D__USES_INITFINI__ -D CPU_MKL25Z128VLK4 -D DEBUG -D FRDM_KL25Z -D FREEDOM ../startup/startup_MKL25Z4.S -mcpu=cortex-m0plus -mthumb -mfloat-abi=soft -march=armv6s-m -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -fworking-directory -O0 -fno-directives-only -o /tmp/ccQABHKC.s
ignoring duplicate directory “/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/8.3.1/include”
ignoring nonexistent directory “/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi/usr/local/include”
ignoring duplicate directory “/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/8.3.1/include-fixed”
ignoring duplicate directory “/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/include”
ignoring nonexistent directory “/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi/usr/include”
#include “…” search starts here:
#include search starts here:
/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/include
/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/include-fixed
/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/include
End of search list.
COLLECT_GCC_OPTIONS=’-mcpu=cortex-m0plus’ ‘-mthumb’ ‘-O0’ ‘-fmessage-length=0’ ‘-fsigned-char’ ‘-ffunction-sections’ ‘-fdata-sections’ ‘-g3’ ‘-D’ ‘CPU_MKL25Z128VLK4’ ‘-D’ ‘DEBUG’ ‘-D’ ‘FRDM_KL25Z’ ‘-D’ ‘FREEDOM’ ‘-v’ ‘-MMD’ ‘-MP’ ‘-MF’ ‘startup/startup_MKL25Z4.d’ ‘-MT’ ‘startup/startup_MKL25Z4.o’ ‘-c’ ‘-o’ ‘startup/startup_MKL25Z4.o’ ‘-mfloat-abi=soft’ ‘-march=armv6s-m’
/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/as –gdwarf2 -v -march=armv6s-m -mfloat-abi=soft -meabi=5 -o startup/startup_MKL25Z4.o /tmp/ccQABHKC.s
GNU assembler version 2.32.0 (arm-none-eabi) using BFD version (GNU Tools for Arm Embedded Processors 8-2019-q3-update) 2.32.0.20190703
COMPILER_PATH=/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/thumb/v6-m/nofp/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi/lib/thumb/v6-m/nofp/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi/lib/
Finished building: ../startup/startup_MKL25Z4.S
COLLECT_GCC_OPTIONS=’-mcpu=cortex-m0plus’ ‘-mthumb’ ‘-O0’ ‘-fmessage-length=0’ ‘-fsigned-char’ ‘-ffunction-sections’ ‘-fdata-sections’ ‘-g3’ ‘-D’ ‘CPU_MKL25Z128VLK4’ ‘-D’ ‘DEBUG’ ‘-D’ ‘FRDM_KL25Z’ ‘-D’ ‘FREEDOM’ ‘-v’ ‘-MMD’ ‘-MP’ ‘-MF’ ‘startup/startup_MKL25Z4.d’ ‘-MT’ ‘startup/startup_MKL25Z4.o’ ‘-c’ ‘-o’ ‘startup/startup_MKL25Z4.o’ ‘-mfloat-abi=soft’ ‘-march=armv6s-m’
OUTPUT OF GNU LINKER
Building target: dac_adc_demo.elf
Invoking: GNU ARM Cross C Linker
arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -T “/home/aheak123/eclipse-workspace/dac_adc_demo/linkerscript/MKL25Z128xxx4_flash.ld” -Xlinker –gc-sections -L/home/aheak123/KSDK_1.3.0/lib/ksdk_platform_lib/armgcc/KL25Z4/debug -Wl,-Map,”dac_adc_demo.map” –specs=nosys.specs -v -o “dac_adc_demo.elf” ./utilities/fsl_debug_console.o ./utilities/fsl_misc_utilities.o ./utilities/print_scan.o ./startup/startup.o ./startup/startup_MKL25Z4.o ./startup/system_MKL25Z4.o ./sources/demo_state_machine.o ./sources/hardware_init.o ./sources/main.o ./board/board.o ./board/gpio_pins.o ./board/pin_mux.o -lc -lm -lgcc -lnosys -lksdk_platform
Using built-in specs.
Reading specs from /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/nosys.specs
rename spec link_gcc_c_sequence to nosys_link_gcc_c_sequence
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/lto-wrapper
Target: arm-none-eabi
Configured with: /tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/src/gcc/configure –target=arm-none-eabi –prefix=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native –libexecdir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/lib –infodir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/share/doc/gcc-arm-none-eabi/info –mandir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/share/doc/gcc-arm-none-eabi/man –htmldir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/share/doc/gcc-arm-none-eabi/html –pdfdir=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/share/doc/gcc-arm-none-eabi/pdf –enable-languages=c,c++ –enable-plugins –disable-decimal-float –disable-libffi –disable-libgomp –disable-libmudflap –disable-libquadmath –disable-libssp –disable-libstdcxx-pch –disable-nls –disable-shared –disable-threads –disable-tls –with-gnu-as –with-gnu-ld –with-newlib –with-headers=yes –with-python-dir=share/gcc-arm-none-eabi –with-sysroot=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/install-native/arm-none-eabi –build=x86_64-linux-gnu –host=x86_64-linux-gnu –with-gmp=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-mpfr=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-mpc=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-isl=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-libelf=/tmp/jenkins/jenkins-GCC-8-build_toolchain_docker-594_20190704_1562200936/build-native/host-libs/usr –with-host-libstdcxx=’-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm’ –with-pkgversion=’GNU Tools for Arm Embedded Processors 8-2019-q3-update’ –with-multilib-list=rmprofile
Thread model: single
gcc version 8.3.1 20190703 (release) [gcc-8-branch revision 273027] (GNU Tools for Arm Embedded Processors 8-2019-q3-update)
COMPILER_PATH=/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/thumb/v6-m/nofp/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi/lib/thumb/v6-m/nofp/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/:/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS=’-mcpu=cortex-m0plus’ ‘-mthumb’ ‘-O0’ ‘-fmessage-length=0’ ‘-fsigned-char’ ‘-ffunction-sections’ ‘-fdata-sections’ ‘-g3’ ‘-T’ ‘/home/aheak123/eclipse-workspace/dac_adc_demo/linkerscript/MKL25Z128xxx4_flash.ld’ ‘-L/home/aheak123/KSDK_1.3.0/lib/ksdk_platform_lib/armgcc/KL25Z4/debug’ ‘-specs=nosys.specs’ ‘-v’ ‘-o’ ‘dac_adc_demo.elf’ ‘-mfloat-abi=soft’ ‘-march=armv6s-m’
/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/collect2 -plugin /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/liblto_plugin.so -plugin-opt=/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccz0K0ND.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lg -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lnosys –sysroot=/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi -X -o dac_adc_demo.elf /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/thumb/v6-m/nofp/crti.o /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/thumb/v6-m/nofp/crtbegin.o /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/crt0.o -L/home/aheak123/KSDK_1.3.0/lib/ksdk_platform_lib/armgcc/KL25Z4/debug -L/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/thumb/v6-m/nofp -L/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp -L/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi/lib/thumb/v6-m/nofp -L/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1 -L/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc -L/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib -L/home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../arm-none-eabi/lib –gc-sections -Map dac_adc_demo.map ./utilities/fsl_debug_console.o ./utilities/fsl_misc_utilities.o ./utilities/print_scan.o ./startup/startup.o ./startup/startup_MKL25Z4.o ./startup/system_MKL25Z4.o ./sources/demo_state_machine.o ./sources/hardware_init.o ./sources/main.o ./board/board.o ./board/gpio_pins.o ./board/pin_mux.o -lc -lm -lgcc -lnosys -lksdk_platform –start-group -lgcc -lg -lc –end-group –start-group -lgcc -lc -lnosys –end-group /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/thumb/v6-m/nofp/crtend.o /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/thumb/v6-m/nofp/crtn.o -T /home/aheak123/eclipse-workspace/dac_adc_demo/linkerscript/MKL25Z128xxx4_flash.ld
COLLECT_GCC_OPTIONS=’-mcpu=cortex-m0plus’ ‘-mthumb’ ‘-O0’ ‘-fmessage-length=0’ ‘-fsigned-char’ ‘-ffunction-sections’ ‘-fdata-sections’ ‘-g3’ ‘-T’ ‘/home/aheak123/eclipse-workspace/dac_adc_demo/linkerscript/MKL25Z128xxx4_flash.ld’ ‘-L/home/aheak123/KSDK_1.3.0/lib/ksdk_platform_lib/armgcc/KL25Z4/debug’ ‘-specs=nosys.specs’ ‘-v’ ‘-o’ ‘dac_adc_demo.elf’ ‘-mfloat-abi=soft’ ‘-march=armv6s-m’
Finished building target: dac_adc_demo.elf
Anthony H.
LikeLike
I cannot see anything wrong right now.
LikeLike
Erich,
Thanks for trying to help me!
Regards,
Anthony H.
LikeLike
Hi Erich, thank you for replying.
When I manually set a breakpoint at Reset_Handler in startup_MKL25Z4.S, it still does not work. I don’t think I disable debugging, because set Debugging option to Maximum (-g3) option and I also added -ggdb on the Miscellaneous field in debug setup.
Regards,
Anthony H.
LikeLike
Hi Anthony,
it is possible that you have set different options for the startup file or its folder (see https://mcuoneclipse.com/2013/06/12/traps-and-pitfalls-no-hexbins19-file-created-with-gnu/). Can you check if it has this ‘needle’ on it? Or maybe you skipped breakpoints (https://mcuoneclipse.com/2013/02/19/skipping-breakpoints/)?
LikeLike
Hi Erich,
I have verified that there is no ‘needle’ in startup_MKL25Z4.S, also my makefile correctly generate the .hex file, see below:
# Add inputs and outputs from these tool invocations to the build variables
SECONDARY_FLASH += \
dac_adc_demo.hex \
SECONDARY_LIST += \
dac_adc_demo.lst \
SECONDARY_SIZE += \
dac_adc_demo.siz \
LikeLike
Can you verify your elf file with the ‘Executables’ view in Eclipse: it shall show all source files involved.
The other thing: check your linker .map file: could it be that somehow it is using anyother file as startup?
LikeLike
Erich,
1) Executable view for dac_adc_demo.elf include the right startup file
start_MKL25Z4.S
2) portion of dac_adc_demo.map also shows
.data 0x0000000000000000 0x0 ./startup/startup_MKL25Z4.o
.bss 0x0000000000000000 0x0 ./startup/startup_MKL25Z4.o
Anthony H.
LikeLike
2) what about the code for the startup? is it listed in the map file too?
Keep in mind that an address of 0x0 (except it is really there) means it has been removed. For the two things above they do not ‘exist’ as the size is zero too.
LikeLike
Erich,
I don’t really understand how to read the map file. Below is a small snippet of dac_adc_demo.map file. Looks like startup_MKL25Z4.o sections are in the discarded input sections. My question is, if the startup code in startup_MKL25Z4.o file is discarded, how can we get to the main function after mcu reset?
Discarded input sections
.data 0x0000000000000000 0x0 ./startup/startup_MKL25Z4.o
.bss 0x0000000000000000 0x0 ./startup/startup_MKL25Z4.o
.text 0x0000000000000000 0x0 ./startup/system_MKL25Z4.o
.data 0x0000000000000000 0x0 ./startup/system_MKL25Z4.o
.bss 0x0000000000000000 0x0 ./startup/system_MKL25Z4.o
.text.SystemCoreClockUpdate
0x0000000000000000 0x238 ./startup/system_MKL25Z4.o
Anthony H.
LikeLike
So indeed you have the startup code not included in your map file/linker. It must looks something like this:
Vector table:
*(.isr_vector)
.isr_vector 0x00000000 0xc0 ./startup/startup_MKL27Z644.o
0x00000000 __isr_vector
0x000000c0 . = ALIGN (0x4)
Flash configuration:
*(.FlashConfig)
.FlashConfig 0x00000400 0x10 ./startup/startup_MKL27Z644.o
0x00000410 . = ALIGN (0x4)
Startup code with all the ISR handlers:
.text 0x000004e8 0xc8 ./startup/startup_MKL27Z644.o
0x000004e8 Reset_Handler
0x00000528 Reserved45_IRQHandler
0x00000528 TPM1_IRQHandler
0x00000528 PORTA_IRQHandler
0x00000528 PIT_IRQHandler
0x00000528 CMP0_IRQHandler
0x00000528 LPTMR0_IRQHandler
0x00000528 TPM0_IRQHandler
0x00000528 LLWU_IRQHandler
0x00000528 Reserved42_IRQHandler
0x00000528 ADC0_IRQHandler
0x00000528 Reserved39_IRQHandler
0x00000528 PORTBCDE_IRQHandler
0x00000528 FTFA_IRQHandler
0x00000528 DefaultISR
0x00000528 TPM2_IRQHandler
0x00000528 Reserved43_IRQHandler
0x00000528 RTC_IRQHandler
0x00000528 RTC_Seconds_IRQHandler
0x00000528 Reserved41_IRQHandler
0x00000528 Reserved20_IRQHandler
0x00000528 USB0_IRQHandler
0x00000528 PMC_IRQHandler
0x0000052c NMI_Handler
0x00000530 HardFault_Handler
0x00000534 SVC_Handler
0x00000538 PendSV_Handler
0x0000053c SysTick_Handler
0x00000540 DMA0_IRQHandler
0x00000544 DMA1_IRQHandler
0x00000548 DMA2_IRQHandler
0x0000054c DMA3_IRQHandler
0x00000550 I2C0_IRQHandler
0x00000554 I2C1_IRQHandler
0x00000558 SPI0_IRQHandler
0x0000055c SPI1_IRQHandler
0x00000560 LPUART0_IRQHandler
0x00000564 LPUART1_IRQHandler
0x00000568 UART2_FLEXIO_IRQHandler
I believe you have screwed up your linker settings.
Make sure your linker does NOT have the option -nostdlib set, and does NOT have the option -nostartfiles set (both options shall not be present). Same for -nodefaultlibs.
LikeLike
It might be that your linker file is wrong too: make sure you are using a correct one, and have something like
/* Entry Point */
ENTRY(Reset_Handler)
in it. Best if you check things with one of the provided examples in KDS or on my GitHub site.
LikeLike
Erich, thank you for the help so far (it is getting late here, so I am going to sleep now), but looking at the dac_adc_demo.map file again, I do see there is code for startup_MKL25Z4.o. Below is a snippet:
.interrupts 0x0000000000000000 0xc0
0x0000000000000000 __VECTOR_TABLE = .
0x0000000000000000 . = ALIGN (0x4)
*(.isr_vector)
.isr_vector 0x0000000000000000 0xc0 ./startup/startup_MKL25Z4.o
0x0000000000000000 __isr_vector
0x00000000000000c0 . = ALIGN (0x4)
.flash_config 0x0000000000000400 0x10
0x0000000000000400 . = ALIGN (0x4)
*(.FlashConfig)
.FlashConfig 0x0000000000000400 0x10 ./startup/startup_MKL25Z4.o
0x0000000000000410 . = ALIGN (0x4)
.text 0x0000000000000410 0x9548
0x0000000000000410 . = ALIGN (0x4)
*(.text)
.text 0x0000000000000410 0x48 /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/thumb/v6-m/nofp/crtbegin.o
.text 0x0000000000000458 0x78 /home/aheak123/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/crt0.o
0x0000000000000458 _mainCRTStartup
0x0000000000000458 _start
.text 0x00000000000004d0 0x18 ./startup/startup_MKL25Z4.o
0x00000000000004d0 Reset_Handler
0x00000000000004e0 I2C0_IRQHandler
0x00000000000004e0 HardFault_Handler
0x00000000000004e0 SysTick_Handler
0x00000000000004e0 PendSV_Handler
0x00000000000004e0 NMI_Handler
0x00000000000004e0 I2C1_IRQHandler
0x00000000000004e0 UART1_IRQHandler
0x00000000000004e0 DMA2_IRQHandler
0x00000000000004e0 TPM0_IRQHandler
0x00000000000004e0 LLWU_IRQHandler
0x00000000000004e0 TSI0_IRQHandler
0x00000000000004e0 UART0_IRQHandler
0x00000000000004e0 ADC0_IRQHandler
0x00000000000004e0 Reserved39_IRQHandler
0x00000000000004e0 SPI1_IRQHandler
0x00000000000004e0 DefaultISR
0x00000000000004e0 PORTD_IRQHandler
0x00000000000004e0 TPM2_IRQHandler
0x00000000000004e0 RTC_IRQHandler
0x00000000000004e0 RTC_Seconds_IRQHandler
0x00000000000004e0 MCG_IRQHandler
0x00000000000004e0 UART2_IRQHandler
0x00000000000004e0 Reserved20_IRQHandler
LikeLike
So that actually looks good:
0x00000000000004d0 Reset_Handler
it is there!
LikeLike
Hi Erich, I am working on mbed MCUs for my uni dissertation and you have really pointed me in the right direction as a beginner. Thank you!
LikeLike
great to hear that, and I wish you all the best and sucess!
LikeLike
Hi Erich thanks for the well wishes, just wanted to ask a quick question. I’m using the FRDM-K64F and converting the library for use on the Zumo robot, similar to what you did! One aspect I’d like to look at is the additional wifi/bluetooth capability of the frdm board compared to the arduino uno. However, I’m not sure how to connect a chip such as ESP8266 or a BLE while the board is connected to the Zumo robot at the same time, without the ability to solder. I was wondering if I could test any additional functionality through maybe the inner row of the FRDM board with the 32 additional pins but I actually have no idea what they are for. All I found online is that they’re for “Headers for proprietary shields”, I’m not sure what a proprietary shield is… Anyway this isn’t a highly important task for my dissertation as the main part is just converting the library but thought it would be interesting if I have time! Thank you so much.
LikeLike
Check the FRDM-K64F schematics about the inner rows: they include some extra signals which are not part of the outer rows (the K64F has more pins available than the number of outer rows.
Standard Ardunio shields only use/have the outer rows of pins. So ‘proprietary’ means as shield/board not only having the outer rows, but the inner ones too.
LikeLike
Hi Erich
I am using MCUExpresso and the K64F freedom board. I have a variable where I store data (12 bytes long). What do I need to do in order not to lose that data after a power off and then a power on. Is there an example.
Thanks
Eli
LikeLike
Hi Eli,
an easy way is to store it in the Flash memory of the K64F, see https://mcuoneclipse.com/2014/05/31/configuration-data-using-the-internal-flash-instead-of-an-external-eeprom/
Erich
LikeLike
Hola. Thanks for the continued blog. I’ve been following for some time and appreciate the bits of wisdom bestowed freely onto the audience.
The reason for my post herein: I am working with a LPC54102 in a different dev environment (ARMbasic – a compiled vs. interpreted language instantiation on many LPC and some Atmel/nRF/STM MCUs). On the LPC54102, I am working to implement a battery powered RTC construct on one of the dev boards I have.
I’ve a ML2020 thereon which is schottky diode isolated from the rest of the board and feeding the four (4) Vdd inputs (pins 8,24,34,& 56 on the QFP-64 package), when power to the onboard regulator gets nix’d. I’m using the regulator to strongly pull up a lightly pulled down IO that I will code to falling-edge-trigger a GPIO interrupt to put the MCU into the deep power down mode, so that the ML2020 can keep the RTC peripheral alive and clocking away.
I am not C savvy but have ported some C code in the past and was looking to do so now, but it seems that the LPC Xpresso power library makes use of .a libraries and not proper C source/header files (whether it is IP related concerns, or ease of distro/use, is unknown to me). In doing some reading, I understand these library files are just uncompressed archives intended to be dynamically linked to during compilation by the C toolchain. I was looking to port some of the procs over from C to AB to make use of them, but find that I can’t find the forest as I can’t see through all of the trees in my way.
What is driving this is that the 54102 doesn’t have a separate Vbat input to the MCU but rather expects devs to put the device into the required power mode, to ensure that the existing battery on the board powers only the peripherals/clocks/etc. desired The firmware for the power control that is baked into the devices ROM is flawed, per the errata, so the use of the LPC Xpresso libs is called for, per the UM.
Ideally, I’d just locate the C source so that I could port that into native AB code. Absent that, I am able to take assembly and run it in my AB sources, via a couple of different mechanisms. In this context, I suspect that I would create a constant (syntax which is pretty similar to C), and then ‘call’ a pointer to that constant’s memory location, to have the proc’s code run as needed, after doing a bin2hex conversion on same and assigning it to said constant.
What I am struggling with, conceptually, is the mechanics of identifying what bits and pieces of the .a embedded .o files are code vs. memory locations of variables/constants, and how to identify, within each proc’s assembled code, where references are made to the variable/constants so that I can point the imported code to the memory locations of the variables/constants that I instantiate in my wrapper code.
Anyways, what I am curious about is if there is anyone who might have trudged down a similar path previously, to solicit them for their process and lessons learned/best practices. If anyone is able and willing to codify same, or point me to where prior work may have codified same, that would be most appreciative. Thank you, in advance.
-t
LikeLike
I would try this with objdump (see https://mcuoneclipse.com/2018/07/08/creating-disassembly-listings-with-gnu-tools-and-eclipse/) which works on object files but should as well on archive files. That way you should be able to get the disassembly code.
LikeLike
Outstanding. Thank you, kind sir. Very much appreciated. Take care.
LikeLike
Hi again
I am using the K64F and am supplying power to it via pin 16 (P5-9V_VIN).
The program only works if there is power via the openSDA usb connector.
If I don’t have the openSDA connected, how do I get the program to run.
As always, I appreciate your help.
Thanks
Eli
LikeLike
You have to check the schematics of your board, as the 3.3V power supply is rather complex and might depend on board revision too. The thing is that usually the 3.3V are generated from the internal 5V to 3.3V DC-DC converter. but the 5V are not generated/present if you have no USB cable connected. See https://mcuoneclipse.com/2013/06/21/5v-generation-from-v_in-on-the-freedom-board-reve/ for one solution.
LikeLike
Hi Erich
Concerning the previous Q&A: K64F rev B did not work but K64F rev E works fine.
Thanks for pointing this to me.
I think I found a problem with MCUXpresso.
I created a new C/C++ Project for the K64F
– selected FreeRTOS and all drivers
– in Middleware I selected USBhost
– in Software components I selected osa_free-rtos
I then created the project and then built it.
I get the following error:
fatal error: usb_osa_bm.h: No such file or directory
Have you seen this?
LikeLike
No, have not seen this. Just tried the same (SDK_2.x_FRDM-K64F 2.7.0 (303 2019-12-19) and that compiles and links fine for me.
LikeLike
SDK examples compiled correctly for me too. The procedure I sited above does not.
LikeLike
I did not use an example, I created a new project with the steps you described. And that worked for me. Maybe it is an issue with the SDK version you are using?
LikeLike
Hi
You were right again. I had SDK version 2.6.0
I upgraded to MCUXpresso 11.1.1 and SDK 2.7.0
I imported SDK example “frdmk64f_host_hid_generic_freertos”
I want to add a Uart to this project so I added the driver “uart_freertos”
When you build this you get an error: malloc.h: No such file or directory
LikeLike
Hi Eli,
did the same on my side. But the uart_freertos driver is already added for me when I import that project. Note that I used the ‘Import SDK example(s)’ from the Quickstart panel.
Everything is building fine that way.
LikeLike
Hi Erich,
I have a question regarding linker script selection vs #define.
I use a bootloader that requires (as most bootloaders) some area at the start of the flash.
If I compile for debugging (without bootloader), I need to select another linker script then with bootloader. This is done by the MCUXpresso – Build Configuration – Set Active (where the selection of the correct script is done). Additionally I need to change my #define BOOTLOADER_VERSION from 1 to 0 or vise versa.
Do you know any solution that I can combine either the #define into the Build Configuration or the linker script selection into the #define area?
Thanks and greetings!
Philipp
Kinetis K66f, MCUxpresso 11.2
Example code here:
*(unsigned long*) 0xE000ED08 = 0x1fff0000; // set the location of interrupt vectors to the start of SRAM
#if BOOTLOADER_VERSION
memcpy((void *)0x1fff0000, (void *)0x00008080, 0x0230); // copy the fixed vectors to SRAM
#else
memcpy((void *)0x1fff0000, (void *)0x00000000, 0x0230); // copy the fixed vectors to SRAM
#endif
LikeLike
Hi Philipp,
I’m doing it the following way:
https://mcuoneclipse.com/2019/10/06/linking-bootloader-applications-with-eclipse-and-freemarker-scripts/
Maybe this is something you could use too?
LikeLike
That was fast! 😉
At the first glace this should work, will try it later thanks!
LikeLiked by 1 person
Hi Erich,
do you have an example or article or tutorial about an implementation of an USB virtual com with, for example, an FRDM board (my HW is an FRDM-K66F) under MCUXpressoIDE?
I have see some example (frdmk66f_dev_cdc_vcom_bm or _lite_bm) and also i have tried with IDEv11.2.0 building code using USBHS peripherals presetting a device CDC VCOM bare metal, but echoing chars don’t work, i think, due to errata USB-VCOM driver on my PC x64 Windows10 based… May be i need a specific driver?
TNX
LikeLike
Hi Antonio,
I don’t have a K66. But the USB should be pretty generic across all Kinetis devices. I do have an example project for the K22 (same as on the FRDM-K22).
I wrote an article about it (https://mcuoneclipse.com/2019/05/05/building-a-raspberry-pi-ups-and-serial-login-console-with-tinyk22-nxp-k22fn512/) and the project is as well on GitHub (see the link at the end of the article). I don’t see any issues with Win10 64bit USB VCOM.
I hope this helps,
Erich
LikeLiked by 1 person
Thanks Erich, solved!
LikeLike
Hi Erich,
Does PCBWAY offer completed board of the tinykl22 or only the pcb? I checked their website and they seem to only offer just the public.
Regards,
Anthony
LikeLike
Hi Anthony,
they offer by default producing the boards, but you can use as well their assembly service (the extra information is on the github). But the price per board will heavily depend on the number of boards. I heard that for 20 boards it is around $50 in total for a board. We produced 400 for the university and the price was around $20 for a single board. So if you are after a single or few boards, you might be better for just the PCB and then assemble the parts yourself.
LikeLike
Hi Erich,
Thank you for replying. Thanks for the info. I wish I could just order just one or two with the price being comparable to the freedom boards. Seems to be too expensive for the assembly service. Maybe I can get this board in the future at Mouser or Digikey with comparable price as the freedom boards.
Regards,
Anthony
LikeLike
Hi Anthony,
unfortunately it is all about volume: The freedom boards get produced probably in the >10k numbers, making it cheaper per board. Plus I assume NXP has not to pay for its own chips. The most expensive part on the tinyK22 is the MCU itself and makes up around half the price in single quantity for the parts. As for alternatives: there is the LPC845-BRK which is around $6 (https://mcuoneclipse.com/tag/lpc845-brk/), but an ARM Cortex-M0 and less powerful. Good board for smaller things which do not require native USB. And there is the Teensy (https://mcuoneclipse.com/2017/04/29/modifying-the-teensy-3-5-and-3-6-for-arm-swd-debugging/) but you have to make a hardware modification to make it working with a debugger.
For Mouser or Digikey probably you would have to produce such a board in >5k quantity, take a huge risk and even leave a margin for them. Maybe a ‘cloning’ company in Asia would pick it up and offer it on AliExpress like the ‘Blue Pill’ boards? STM in my view did a great job with the NUCLEO boards: I wish NXP would have the same, but they have it only with the LPC845-BRK one.
LikeLike
Hi Erich,
I’m using a K22FN512 and FRTOS and USB serial. I’m having trouble in that my serial coms work fine one way, but back the other direction it doesn’t seem to work right.
I took a look at what I thought was the rx buffer, and it had both the outgoing tx bytes in it, and my missing packet from the other direction. the CDC1 component uses both an RX1 component and a TX1 component. why am I seeing (charactors going) both directions in the same buffer?
This buffer is the argument to the CDC1_app_task() call.
Brynn
LikeLike
Have you turned on pull resistors on the Rx and Tx UART lines? Not sure if this is the same on your side, but in the past I have seen cross talk if not having pull resistors (at least internally), showing up what I’m sending on Tx in the Rx again.
I hope this helps,
Erich
LikeLike
I don’t think there is really a Rx and Tx line at all. This is a USB virtual com port (the FSL CDC device). At one point I wanted to hook an Oscope up to look at the serial stream, then I remembered that it would be trying to look at USB – with which it might be possible to see the serial packets inside whatever the USB wraps around it, but I figured that would be more difficult, and maybe not worth the effort.
Brynn
LikeLike
ah, I thought it is that kind of UART to USB CDC scenario as on the FRDM boards (target sending to UART to the K20).
So not sure what it could be (dangling pointer maybe? stack overflow? not enough stack space).
The other thing is that the USB task pushing the USB engine needs to run at a high frequency/high priority to make sure the USB peripheral is served on time.
LikeLike
This is all from working code that I am transmogrifying to serve a different purpose. The USB engine runs once every 1 to 10 milliseconds. and IIRC the USB interrupt priority is set high.
How come when (in KDS 3.2) when I put an breakpoint on the second line below
if (CDC1_GetChar(&user_char)==ERR_OK){
cdc_buffer[ptr]=user_char;
That the debugger crashes?
You can see that I am manually copying the char to the cdc_buffer. maybe this is not how it should be? Also ptr is clamped between 0 and the sizeof the buffer-1.
LikeLike
First: the debugger should not crash or course.
Below is some bare metal code from one of my examples which echos the received characters, maybe this helps?
Example from https://github.com/ErichStyger/mcuoneclipse/blob/master/Examples/KDS/FRDM-K20D50M/FRDM-K20_USB_CDC/Sources/main.c
static uint8_t cdc_buffer[USB1_DATA_BUFF_SIZE];
static uint8_t in_buffer[USB1_DATA_BUFF_SIZE];
static void CDC_Run(void) {
int i;
uint32_t val = 0;
unsigned char buf[16];
for(;;) {
while(CDC1_App_Task(cdc_buffer, sizeof(cdc_buffer))==ERR_BUSOFF) {
/* device not enumerated */
LEDR_Neg(); LEDG_Off();
WAIT1_Waitms(10);
}
LEDR_Off(); LEDG_Neg();
if (CDC1_GetCharsInRxBuf()!=0) {
i = 0;
while( i<sizeof(in_buffer)-1
&& CDC1_GetChar(&in_buffer[i])==ERR_OK
)
{
i++;
}
in_buffer[i] = '\0';
(void)CDC1_SendString((unsigned char*)"echo: ");
(void)CDC1_SendString(in_buffer);
UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"val: ");
UTIL1_strcatNum32u(buf, sizeof(buf), val);
UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n");
(void)CDC1_SendString(buf);
val++;
} else {
WAIT1_Waitms(10);
}
}
}
LikeLike
Hi Erich,
I have a situation where in like if control goes into one function i need to change the value of one global variable present in that file,but as soon as i changed the value performing NVIC_RESET()
so i am losing the variable value,but i need that variable value to be retained since i have to compare it in another functions of that file.
How we can achieve it???PLs help me
Thanks megha
LikeLike
Hi megha,
not sure if I understand: you want to set a variable in RAM and be able to read that variable value after a reset (so it does not get initialized during startup)?
Maybe you are looking for a NO INIT or NO LOAD (see https://mcuoneclipse.com/2014/04/19/gnu-linker-can-you-not-initialize-my-variable/)?
LikeLike
Thanks eric it has cleared my doubt and one more thing i.e
in atmel studio
i declared a variable as
bool enable = false
how to make enable value as true(how can we negate that value in GCC compiler
Thanks
megha
LikeLike
To set the value to true:
enable = true;
to set the value to false:
enable = false;
to toggle the value:
enable = !enable;
LikeLike
Hello Erich
What do you think about learning vim and using it in Eclipse (Vrapper for example)?
Is it worth it?
-L-
LikeLike
I have not tried it, but if you like Vi(m) there are plugins available: https://marketplace.eclipse.org/category/free-tagging/vim
LikeLike
Hi Erich
I got a new K64F board and it comes with Mbed. I want DAPLINK. I followed the procedure to download DAPLINK and when I plug in the board it shows up as DAPLINK but the red light on the board goes on and MCUExpresso does not see the board. What did I do wrong and how can I solve this.
Thanks
LikeLike
I usually do not use DAPLINK as it is slow compared to SEGGER plus has issues with Windows 10 (see https://mcuoneclipse.com/2017/10/29/adding-a-delay-to-the-arm-daplink-bootloader/). I recommend that you try the J-Link firmware instead https://mcuoneclipse.com/2014/04/27/segger-j-link-firmware-for-opensdav2/ or use my patched bootloader.
LikeLike
When I power the K64F with the reset button pressed it enumerates as MAINTENANCE. Can I still drag and drop 02_OpenSDA_FRDM-K64F.bin or do I need to recover the BOOTLOADER
LikeLike
You still can load the .bin, but if your bootloader is not protected against Win10, it will go back to the bootloader mode again.
If you have the original bootloader on the board and a Windows 10 machine, you definitely want to update the bootloader.
LikeLike