Can anybody speak from Freescale MQX/Kinetis bootloader team on how do you folks take feedback and bug reports from companies like us ?
WE have found 2 very serious issues in MQX 4.1.1 (causing wrong flashing and causing processor reboots) and given feedback to relevant people (FAE) etc etc, but NO action has been taken on them.
Instead we are told to forcibly buy customer support package, we would opt for it only if it was something new we are trying to do BUT these issues are clearly MQX issues and have been acknowledged but without ACTION.
We as a company do NOT like this sort of customer treatment.
We expect immediate action on them.
Email/Respond to this message so that I can email you the details (discussion with FAE etc etc)
Thanks and Regards
Nitin Harish
已解决! 转到解答。
Yes, it's a bug. The file extension filter should not have gone out with SREC as an option.
Hi Nitin,
I am the product manager for MQX software at Freescale. I will personally investigate this and get a resolution. I agree that it is not acceptable to keep you in the dark about the response to your bug reports.
Can you please confirm the specific threads in which you reported the issues?
I see this one. Can you provide the other(s)?
BUG REPORT: Clocking K64 using 32KHz IRC in MQX 4.1.1/4.2?
Thanks,
Mac Lobdell
Thanks Maclain,
I cannot begin to tell you what a relief I got after seeing your designation. Now I have email chains which date back to 2 months. How should I hand them over to you (some private area) ?
And yes, 32KHz clock issue seems to be digested by MQX team.
Anyway, summary of other issues:
We see processor reboots whenever any variable with dynamic allocation crosses SRAM lower to upper boundary (spread across 0x1FFFFFFF) and we try to memcpy.
In order to avoid that, IAR suggested using linker file which partitions SRAM to upper and lower regions and keeps HEAP assignments in one of the regions. WE as a company do not agree with it, reason, our STACK could be bigger or slimmer and could or could NOT fit in LOWER/UPPER region why should we unnecessary waste 1 of the regions by allocating HEAP or STACK only to one of it.
So, in order to avoid using linker config file solution and wasting memory regions, I came up with a simple solution, place a dummy variable @ SRAM boundary between lower and upper regions (for my K64 it is 0x1FFFFFFF), it works FINE. No issues. But we need blessings from you and IAR folks that it is OK to use this method and we will be safe. Can we get that ? Also, we had concerns if we use memcpy from lower to upper memory region variable copying or vice versa but recently after talking to Doug it seemed like that is not an issue but boundary crossing still remains an issue.
Can we put our product into production using dummy variable placed across memory boundary ?
We expect SRAM U/L access issue (I hope you are aware that the root cause of this issue is Freescale uses 2 different buses to access these 2 regions, I think CODE bus and SYSTEM bus) to be handled by IAR/Freescale not by application makers like us.
CONFIRMATION, that it is a MQX issue:
Ok, I thought more about this.
I think in _bsp_init function of MQX a call is made like this:
/* Memory splitter - prevent accessing both ram banks in one instruction */
_mem_alloc_at(0, (void*)0x20000000);
This call’s success or failure is NOT acted upon, I debugged it and found to my dismay that it FAILS but MQX code does NOT care if it fails or NOT and that is the core reason that my code later ON can get access to memory boundary in SRAM.
Please see the video here (and please share this video with your developer): https://www.dropbox.com/s/kk88c8lcwj3uvgy/_bsp_pre_init_MEMFail.mp4?dl=0
2. Kinetis Bootloader issue:
We have another one for the Freescale/IAR team.
Here is the code snippet:
#define SOFTWARE_VERSION_SIZE_BYTES 18
const char SOFTWARE_VERSION[SOFTWARE_VERSION_SIZE_BYTES] @ ".MainSoftwarVerLoc" = {"APP.000.0016.0000"};
#pragma required=SOFTWARE_VERSION
If I use this code and build a binary and use FSL Kinetis bootloader WINDOWS APP (v 1.0.2) to flash it, everything is fine.
BUT, If I delete the location for that variable by deleting the red text above, a new SREC file is generated.
And this new SREC file flashes OK (at-least that is what my Windows PC application of Kinetis bootloader states) with FSL Kinetis boot loader but my application does not run, I dug deeper and found the issue is while flashing the new SREC file (which does not have .MainSoftwareVerLoc defined), Kinetis bootloader skips the Interrupt vector table for my APP (IVT is @ 0xA000) but still states everything is OK.
Why is Freescale Kinetis bootloader stating that everything flashed OK with new SREC although it skipped flashing IVT @0xA000 and why did it skipped that location with new SREC file ?
Attached are the MAP/SREC/ICF file with and without MAINVErsionString defined (their names are self-explanatory).
After a while, trail went cold on issue #1 (I posted the video, you can see above), and I was told that issue #2 will be reported internally (but it never happened even after 1 month of waiting).
Hi Nitin,
I have been in contact with our development team and our FAEs that have been working directly with you.
First, I want to say that I am sorry that we didn’t meet your expectation in these cases. We are investigating ways we can be more transparent in our bug tracking systems in the future.
In regards to these two issues, as you have noted, the first is definitely related to the known behavior of the ARM Cortex M4 SRAM being split. This is documented in the Kinetis MCU reference manuals.
For example, page 109 of http://cache.freescale.com/files/microcontrollers/doc/ref_manual/K64P144M120SF5RM.pdf
NOTE
Misaligned accesses across the 0x2000_0000 boundary are not supported in the ARM Cortex-M4 architecture.
Our belief is that the workaround already present in the code (allocating a small amount of memory at the border) sufficiently handles this correctly. This prevents further allocations in that area which could yield accesses across the boundary which are not supported.
If the application later tries to allocate memory across the border, it must fail, because this is an unsupported action. The failing lwmem allocation reports the error back to the calling function so it can choose another location to allocate from. This is expected and necessary.
Can you please confirm if the lwmem memory allocation error is happening in the BSP or in your application? If from the BSP, then perhaps this condition is not handled correctly there, considering the test case you reported puts the heap right at the boundary, which is not typical. If from your application, then I recommend adding code to re-try the allocation for a different location if there is an error.
I have asked our development team to provide more details. As they are in a different time zone, it is already past their working hours. We should have confirmation/more details on Monday for you.
As for issue #2, I have reached out to the development team to confirm they had received the bug ticket. I believe we need more information to understand the issue. If the software version is deleted, is the reference also removed from the linker file? Perhaps without the version set in the code, the linker is getting confused. Please confirm, we will also get more help for you on this.
Thanks,
Mac
Yes Maclain,
You got it right, video shows the main issue as _bsp_init point where dummy allocation is made so that none of the heap should cross SRAM boundary is failing. And later ON, my code gets access to it and fails causing processor reboot.
I am also sorry to dump so much information at once (actually it is a copy paste of multiple emails). Feel free to contact me for clarifications.
Hii Nitin,
In regards to issue #1, I spoke with our FAEs that are working with you directly on that issue. It sounds like the error was a result of global data in your application already allocated over and past the boundary between the two SRAM blocks, which resulted in the error when the bsp tried to allocate later at the boundary.
Please let me know if you are able to implement a sufficient work-around. Do you consider this issue closed?
Again, I apologize for the time it took to resolve the issue and give you transparency about our bug submission process. Thanks for your patience. In cases like this, where we have trouble re-creating the issue, it is really helpful to get as much information as possible including a test case example project. This greatly helps accelerate the process of isolating bugs or providing troubleshooting assistance.
Thanks,
Mac
macl
Thanks for your effort. (We truly appreciate your follow up and willingness to help)
Issue#1 is NOT because of any errors in our code, it is just a use case which is not handled correctly by MQX BSP (MQX assumes it is going to get access to 0x20000000, which becomes incorrect for our use case), I think I told DavidS and GarySegal that MQX should be smarter in handling and at least should check whether it got memory which it asked for) AND yes, it is true, our workaround is OK for us.
But as far as closing the issue, I would say putting smarter checks in BSP for allocating pseudo bytes @ 0x20000000 needs more work by MQX team. Strongly recommend to sanity checks !
And as far as issue#2 goes, Can you folks please support flashing SRECs (looks like that is pretty much supported but has some bugs), our in-house application parses and flashes any SREC perfectly fine and hope you could also do the same. Let us resolve issues and scrub bugs rather than cutting off the functionality (which I am sure must be liked by embedded community)
Oops, I forgot to reply to your comments about Issue#2.
We do not manually remove VersionString from LCF file because IAR linker does that for us, all un-used function calls are removed by the compiler and any un-used calls to locations is taken out by the linker.
Anyway, our code has grown up from the time I started this issue 2 months back and now.
So, now it seems that VersionSTring was just a delusion. With or without it, now Kinetis Bootloader claims it has flashed everything fine but it has NOT.
This is snapshot of PC loader APP claiming everything is FINE:
After flashing, my image never starts, so I attached my debugger to see what is going on in processor's head and
I know that my image starts from 0xA000 and look at the memory map:
It seems like PC APP/Bootloader forgot to flash that region but somehow thought it is OK/FINE to do that.
Also, Please find attached our bootloader and app which we are trying to flash.
I was able to reproduce your problem. After speaking with the developers of the host-side update utility, it appears that even though SREC is available as an option for the file to be downloaded, it's not actually supported in the tool. Please try generating your application image as a raw binary (BIN) file and try updating it that way.