USB file management on RZ/A1
Hello
I’ve successfully implemented the Renesas USB sample program into the FreeRTOS with a few tweaks to make it running on my embedded system. Now I’m able to select either the default startup procedure of the FreeRTOS or the Renesas sample code from a console. I’ve not yet defined any priorities to the sample programm, because this will be done in a later stage.
I’ve seen that the Default FreeRTOS allows files to be generated, copied and deleted.
It actually generates some files at startup, which is great!
So at this moment 2 questions arise in order for me to continue working on my embedded system:
-How do I copy any random file from the RAM to the USB flash drive?
-Probably related: On which address will the files be generated in the internal RAM of the RZ/A1?
I’d like the user to be able to copy either one of these automatically generated files to an USB flash drive via console input.
The procedure for opening communication to the flash drive is as follows:
-input command “USBH” from console which tells the CPU to turn into Host mode
-selecting USB channel 1 which is connected to the usb Flashdrive
-input command “mopen” from console to open a communication bus to the drive
After the communication bus has been opened, I can successfully read the Flashdrive’s properties and parameters.
Can anyone point me in the right direction to solve this file copy difficulty?
Thanks!
USB file management on RZ/A1
I am not familiar with the flash drive files – but it sounds like it is a Renesas demo so are there any Renesas examples you can copy?
As far as reading files form the RAM disk goes, I think there are examples in the standard demo that does this. For example, you can look at how the ‘copy’ and ‘type’ commands are implemented – both read files form the RAM disk I think.
Regards.
USB file management on RZ/A1
Thanks for the quick response!
As far as I can tell, the Renesas sample software only contains code to open communication to the USB flash drive. It doesn’t include any files or functions which relate to file copying or file generating.
Ah I’ve overlooked that second part from your response. I see that the static portBASE_TYPE prvTYPECommand simply calls a memset to generate the files in the RAM. However the end address of my binary file states 0x2030CA8C. Does a memset occupies the next few addresses in the RAM to put these files in?
USB file management on RZ/A1
I’m afraid I can’t assist with using Renesas’s drivers. I’m not
familiar with them myself.
Ah I’ve overlooked that second part from your response. I see that the static portBASE_TYPE prvTYPECommand simply calls a memset to generate the files in the RAM. However the end address of my binary file states 0x2030CA8C. Does a memset occupies the next few addresses in the RAM to> put these files in?I don’t understand you comments here. Presumably the type command uses the fopen() function to open a file, then the fread() function to read the contents of the file. These are ‘standard’ file system functions.
USB file management on RZ/A1
You are right, the FreeRTOS uses the function fopen() and fclose(). Is there any way I could open an USB port from within the dafualt function calls of FreeRTOS? And if so, what destination address should I type in the console in order to copy one file? In other words; how can I get out of the root folder and into a USB folder?
Is it something like this?
copy root001.txt /USB1/copyofroot
USB file management on RZ/A1
Does the code from Renesas mount a file system on /USB1 that uses their
drivers for input and output? If it does then you would need to use the
same file system for both the RAM disk and the USB drive, and for sure
if you are taking file system code from two different sources that won’t
be the case.