Time for a new major update of the McuOnEclipse components, with the fillowing main features and changes:
- FatFS component updated to R0.12 with patch 3 and exFAT support
- Extended support for Cortex-M7
- Extended support for Kinetis SDK V2.0
- USB component support for Kinetis SDK V1.3
- Improved FreeRTOS for NXP FreeRTOS TAD plugin
- Added C++ wrappers to multiple components
- Many smaller fixes and improvements
FatFS
It comes now with support for exFAT which removes the 4 GB file size limit of FAT32 (see http://www.howtogeek.com/235596/whats-the-difference-between-fat32-exfat-and-ntfs/).
With R0.12, several new API functions are now supported:
- f_expand()
- f_setlabel()
- f_getlabel()
- f_findfirst(), f_findnext()
Additionally block SPI block operation and SDHC access has been optimized, reaching typical 150 kByte write and 300 kByte read performance without DMA (depends on clock speed and SD card used).
FreeRTOS
I had several cases where the NXP FreeRTOS TAD plugin (see “Adding FreeRTOS Thread Awareness to GDB and Eclipse“) was not properly showing information, if the compiler has optimized variables so they were not accessible any more. I have patched the kernel and now it works fine as well on ARM Cortex-M7.
Support for Cortex-M7 has been cleaned up and extended in the FreeRTOS port, mainly with proper identification macros. The critical section handling in the CriticalSection component has been aligned with the FreeRTOS critical section handling and now properly supports interrupts.
Kinetis SDK
Several components including the KinetisTools one have been extended to be used with the Kinetis SDK. An application used with the TWR-KV58F220M (see “First steps: ARM Cortex-M7 and FreeRTOS on NXP TWR-KV58F220M“) using Kinetis SDK, FreeRTOS v9.0.0, Segger RTT, SystemView and Percepio trace is available on GitHub.
Additionally, now you can use the McuOnEclipse USB component/stack with the SDK v1.3. An example project is available on GitHub.
Summary
I hope this updates and features are useful for you. Changes are documented on GitHub. The release is available on SourceForge: https://sourceforge.net/projects/mcuoneclipse/files/PEx%20Components/
See “McuOnEclipse Releases on SourceForge” how to install the update.
Happy Updating
Links
- Difference between FAT32, exFAT and NTFS: http://www.howtogeek.com/235596/whats-the-difference-between-fat32-exfat-and-ntfs/
- McuOnEclipse Component GitHub Repository: https://github.com/ErichStyger/McuOnEclipse_PEx
- McuOnEclipse releases on SourceForge: McuOnEclipse Releases on SourceForge and https://sourceforge.net/projects/mcuoneclipse/files/PEx%20Components/
Hi Erich,
thanks for your great components!
One remark to this article: I think you forgot to place a link in the text. Under “Kinetis SDK”: “An application used with the TWR-KV58F220M (see “xxx”) using Kinetis SDK”.
You intended to place some link instead of XXX, didn’t you?
Regards,
Axel
LikeLike
Hi Axel,
yes, that was a placeholder for a link, I have fixed it now.
Thanks!
Erich
LikeLike
Your FAT example using PE explains in one picture the mistake NXP is making dumping PE: you can browse settings in an unfamiliar module quickly instead of reading 10 pages of manuals and typing on all the OR clauses of settings.
LikeLike
Yes, such a setting page gives fast and convenient access to driver settings in an intuitive way. I still wrapping my mind around how to deal with the ‘post Processor Expert’ area. Keil has in MDK a nice properties description language (RTE, see https://mcuoneclipse.com/2016/02/14/are-arm-cmsis-pack-the-future-of-software-components/), but this is very much tight to CMSIS-PACK. I’m looking for a true open source way to have a simple graphical representation of settings in a view, which then uses the source files and can generate settings files. Something like the Keil “Configuration Wizard” (http://www.keil.com/support/man/docs/uv4/uv4_ut_configwizard.htm), but in Eclipse. Something like https://sourceforge.net/projects/cmsisconfig/.
Maybe you have any idea or other tips?
LikeLike
Hi Erich,
I have updated KDS 3.2 with these PE components but now PE returns the error “No type specified (Use Find)” in FAT_FileSystem component of an existing project based on a K20DN512. In the component panel the expected options of the “Use Find” are missing and the resulting value is -1. Do you have any suggestion on what to do?
Thanks and best regards, Michael
LikeLike
Hi Michael,
i’m not sure what it causing this. Could you send me at least some screenshots to the email address listed in https://mcuoneclipse.com/about/ (under contact information)?
Until then, I will check if I can narrow this down, but my projects did not expose any issues. Except one with long file name support which I already have fixed on GitHub (https://github.com/ErichStyger/McuOnEclipse_PEx/commit/5a942352a2cf4cee5ef006c50ca355433ab60697).
Thanks,
Erich
LikeLike
false alarm: I deleted the Generated_code and Release directories and magically the error disappeared!
Thanks for your time Erich
LikeLike
Ah, ok :-), thanks for letting me know!
LikeLike
hi Erich,
I need to use debug BDM freescale MCU (MC9S12C64), my equipment debugging is USBDM on the BDM port of MCU MC9S12C64.
you know any sofware free to do this? the codewarrior so allows 32k in free version.
or cracked.
Student purposes only.
thank you
LikeLike
Hi Rafaelo,
I have not used USBDM with S12 devices, so I cannot help much on this. CodeWarrior for sure is a good option, but here I recommend to use the P&E Multilink, but it is not free.
Erich
LikeLike
Hi Erich, how are you, i install this componets in kd3.0 and show me some warnings like:
Generator: Warning: at line 135: {{DEVELOPMENT}} The symbol “SaveSymbol__REG_INIT_ONLY__” is not described in the header/comment and is not undefined at the end of included file. (file: Drivers\Kinetis\Static_FTFx_FlashConfig.prg) Cpu Processor Expert Problem
what that means?
Thank you for your work around mcu 🙂
LikeLike
Hi Marcela,
have you turned on the Processor Expert debug mode? Go to Window > Preferences > Processor Expert > Component Development and check if “Enable Processor Expert Components Debug Verbose Mode” is *disabled”?
I hope this helps,
Erich
LikeLike
Erich,
Thanks for all the work. It is really helpful!
Is there a USB TMS (test and measurement class) support with the K64F freedom board?
Weimin
LikeLike
Hi Weimin,
I’m not aware of a TMS implementation. But with the right knowledge of that descriptor and class you could implement it maybe yourself using the existing stack?
Erich
LikeLike
Hi Erich, thank you for the regular updates and the helpfull components, I use them in many projects.
I think I found a copy past error in Kinetis Tools Components in routine UIDGet. The code is :
uid->id[4] = (SIM_UIDML>>24)&0xff;
uid->id[5] = (SIM_UIDML>>16)&0xff;
uid->id[6] = (SIM_UIDMH>>8)&0xff;
uid->id[7] = SIM_UIDMH&0xff;
but should be:
uid->id[4] = (SIM_UIDMH>>24)&0xff;
uid->id[5] = (SIM_UIDMH>>16)&0xff;
uid->id[6] = (SIM_UIDMH>>8)&0xff;
uid->id[7] = SIM_UIDMH&0xff;
I think.
best regards,
Hans
LikeLike
Hi Hans,
indeed, a copy-paste bug :-(. I have fixed it right now (https://github.com/ErichStyger/McuOnEclipse_PEx/commit/5429d498de496d0ec449800f9812532f185f41e8) and of course it will be part of the next release. Thanks so much for reporting, it is a shame that I did not notice that one myself 😦
LikeLike
Hi Erich,
In my application I use the PE FatFS component. To read a directory I use the component methods opendir and readdir. But what I missed is the counterpart to opendir. As a workarround I directly used f_closedir().
For completion it would be good to have the method closedir in the FatFS component interface.
Thanks
Michael
LikeLike
Hi Michael,
thanks for that feedback and suggestion, a really good one. I’m going to add that interface 🙂
LikeLike
Hi Erich,
Here are issues in methods FATM1_disk_read and FATM1_disk_write if we read or write more than 2 sectors (((sector_size – offset) + count to read/write) > sector_size) and address of buffer is not multiple of 4.
Problem that if we pass into method SD_TransferBlock misaligned buffer, DMA of SDHC reads/writes by blocks of 4 bytes.
For example:
buffer has address 3
we read 2050 bytes.
first 512 bytes (sector 0) will be read from cache
sectors 1,2 and 3 will be read thru DMA into following addresses 512, 1024 and 1536, but not 515, 1027 and 1539 as we expected
sector 4 will be read into cache and the rest 2 bytes will be read into address 2051.
i used intermediate buffer to read/write from/to files.
my version of these functions:
DRESULT FATM1_disk_read(uint8_t drv, /* Physical drive number (0..) */
uint8_t* buff, /* Data buffer to store read data */
uint32_t sector, /* Sector address (LBA) */
uint8_t count /* Number of sectors to read (1..255) */
)
{
(void)drv; /* not used */
if (!count)
return RES_PARERR;
if (Stat & STA_NOINIT)
return RES_NOTRDY;
uint8_t* buf = buff;
bool misaligned = (size_t)buff % 4;
if (misaligned)
buf = (uint8_t*)malloc(FATM1_BLOCK_SIZE);
if (!buf)
return RES_NOT_ENOUGH_CORE;
do
{
if (SD_TransferBlock(&SD, TRUE, sector * FATM1_BLOCK_SIZE, buf))
break;
if (misaligned)
{
memcpy(buff, buf, FATM1_BLOCK_SIZE);
buff += FATM1_BLOCK_SIZE;
}
else
buf += FATM1_BLOCK_SIZE;
sector++;
} while (–count);
if (misaligned)
free(buf);
return count ? RES_ERROR : RES_OK;
}
const uint8_t* buff, /* Data to be written */
uint32_t sector, /* Sector address (LBA) */
uint8_t count /* Number of sectors to write (1..255) */
)
{
(void)drv; /* not used */
if (!count)
return RES_PARERR;
if (Stat & STA_NOINIT)
return RES_NOTRDY;
if (Stat & STA_PROTECT)
return RES_WRPRT;
uint8_t* buf = (uint8_t*)buff;
bool misaligned = (size_t)buff % 4;
if (misaligned)
buf = (uint8_t*)malloc(FATM1_BLOCK_SIZE);
if (!buf)
return RES_NOT_ENOUGH_CORE;
do
{
if (misaligned)
memcpy(buf, buff, FATM1_BLOCK_SIZE);
if (SD_TransferBlock(&SD, FALSE, sector * FATM1_BLOCK_SIZE, buf))
break;
if (misaligned)
buff += FATM1_BLOCK_SIZE;
else
buf += FATM1_BLOCK_SIZE;
sector++;
} while (–count);
if (misaligned)
free(buf);
return count ? RES_ERROR : RES_OK;
}
If you have better solution, I’d glad to use it
Best regards, George.
LikeLike
Hi George,
would it not be better and easier to make sure that your buffers are aligned at 4?
LikeLike
Hi Erich
Of course, my buffer is aligned by 4. But sometimes I need to read chunk of file into middle of that buffer.
For example I have buffer I use for sending/receiving file to/from server. So it has header, for example 3 bytes (chunk number and other stuff). Right after header goes data from file.
I read file into that buffer like f_read(fp, &buffer[3], bytesToRead, &bytesRead)
Same with writing. I got data from server. Header’s length is 3 bytes and followed by file data. Then i write like f_write(fp, &buffer[3], bytesToWrite, &bytesWritten)
As you can see i have to use intermediate buffer to workaround this bug of SD’s DMA.
LikeLike
Hi George,
I see, that makes indeed sense. So far I don’t see any better solution than what you have implemented.
Erich
LikeLike
there’s in WAIT component WaitOsms function
better use vTaskDelay((TickType_t)ms*configTICK_RATE_HZ/1000)
instead of vTaskDelay(ms/portTICK_PERIOD_MS)
if we unroll macro portTICK_PERIOD_MS we get vTaskDelay(ms/((TickType_t)1000/configTICK_RATE_HZ))
and if configTICK_RATE_HZ is greater 1000, you’ll get zero. So multiply first, then divide
LikeLike
Thank you, good point!
Actually the better way is to use vTaskDelay(pdMS_TO_TICKS(ms)) as this is now the recommended way, and allows to overwrite the macro by the user code.
LikeLike
Oh, yes. Default definition of this macro is the same. Thank you for hint. I’ll use this macro instead of my code
LikeLike
I have started using that macro in my code too as much as possible. Still legacy code are using the ‘old’ way how FreeRTOS was used (as well in many FreeRTOS examples).
LikeLike