Comments (55)
Hi Rong,
thanks for reporting this issue. Indeed, I should have better used the common memory utility. I have now fixed this, and it is available in this commit:
ErichStyger/McuOnEclipse_PEx@85675b6
Erich
from mcuoneclipse.
Dear Professor Erich,
Thank you very much for your help
.
There is another compiler error in the same file:
"RES_NOT_ENOUGH_CORE" is undefined.
Please help,
Rong
from mcuoneclipse.
Dear Professor Erich,
from mcuoneclipse.
Dear Professor Erich,
We do not use any RTOS. How to fix the following compiler error, which happened after comment out "#include freertos.h":
"RES_NOT_ENOUGH_CORE" is undefined.
Thanks,
Rong
from mcuoneclipse.
I'm not able to reproduce that. Can you provide more details?
Thank you,
Erich
from mcuoneclipse.
Dear Professor Erich,
Is the constant "RES_NOT_ENOUGH_CORE" defined in freertos.h???
The error message ""RES_NOT_ENOUGH_CORE" is undefined" shows up after deleting
"#include freertos.h".
The C code statement "return RES_NOT_ENOUGH_CORE" is near the place where you modified the code last time. Compiler gives error to this constant twice since it is used twice.
We do not have RTOS and only added your "FSL_USB_STACK" and "FatfsMem_USB_MSD" components into our PE, which is part of our IAR project.
The question is where the constant "RES_NOT_ENOUGH_CORE" is defined - Is it in freertos.h???
Thanks,
Rong
from mcuoneclipse.
RES_NOT_ENOUGH_CORE is part of diskio.h:
/* Results of Disk Functions /
typedef enum {
RES_OK = 0, / 0: Successful /
RES_ERROR, / 1: R/W Error /
RES_WRPRT, / 2: Write Protected /
RES_NOTRDY, / 3: Not Ready /
RES_PARERR, / 4: Invalid Parameter /
RES_NOT_ENOUGH_CORE / 5: Not enough memory / / << EST added */
} DRESULT;
It is generated for me from FatFsMem_USB_MSD component.
from mcuoneclipse.
Dear Professor Erich,
I do have diskio,h located in ....\PE\Source\, dated as April 2015 - Not generated this time.
-
"RES_NOT_ENOUGH_CORE /5" is missing in this file. There are only other 4's.
I added the above missing line and I am able to compile the all PE files
1, I am not sure if there is any other difference between my diskio.h and your diskio.h . -
When I tried to rebuild the while IAR project, I got:
"Build error: Multiple tools write to the same file"
Now I can NOT build my IAR project.I never see this error before - "Build error: Multiple tools write to the same file"
Thank you very much for your help,
Rong
from mcuoneclipse.
Dear Professor Erich,
There are more info with "Build error: Multiple tools write to the same file"
Tool 1 - .......\PE\Generated_Code\mem_util,c
Tool 2: ........\PE\Sources\USB_Host\app_msd\mem_util.c
Look like there is some conflict there.
Thank you very much for your help,
Rong
from mcuoneclipse.
Dear Professor Erich,
All files in Tool 2: ........\PE\Sources\USB_Host\app_msd\ were dated months ago.
1. device_driver_info.c and .h
2. mem_util.c and .h
3. msd_commands.c and .h
Should I delete them?
Thanks,
Rong
from mcuoneclipse.
Hello,
I don't know why you have these old files. So yes, best if you make a backup (just in case) and delete all the generated files, then re-generate them. It seems that the IAR tools are doing bad things with your files :-(
from mcuoneclipse.
Dear Professor Erich,
I will try tomorrow since I will have a meeting soon.. I will let you know tomorrow what happens
Another person was working on this project who loaded Freescale USB component (without FAT). I suspect if those files were generated back then. I deleted that component and loaded yours. That is the history.
Thank you so much!
Rong
from mcuoneclipse.
Dear Professor Erich,
-
I deleted all generated files. Then I rerun the PE code generation.
-
diskio.h was not generated however (Why). I had to copy the older version of this file into the project.
-
When compiled in IAR, there is errors in khci_kinetis.c on line 306 and line 620 -
"g_Mem" is not defined.
I do not understand it.Could you help???
Thanks,
Rong
I do not understand
from mcuoneclipse.
Dear Professor Erich,
(Continue) Your "FSL_USB_STACK" and "FatfsMem_USB_MSD" components are in our PE, which is part of our IAR project, Our main project does not use any RTOS.
"diskio.h" was not generated by PE
When compiled in IAR, there is errors in the generated file "khci_kinetis.c"
""g_Mem" is not defined" on line 306 and line 620 -
.
Thanks,
Rong
from mcuoneclipse.
Hi Rong,
I have not used IAR for a while, and not sure what is wrong. Maybe you can attach your project so I can have a look?
Erich
from mcuoneclipse.
Dear Professor Erich,
- How to attach our project zip file and send it to you?
- Our PE did not generate "diskio.h" (I had to copy it from KSDK1.2.0 USB files - not 100% as same as your "diskio.h"). This problem is unrelated to IAR
- Our PE is v10.4.2. I loaded your "FSL_USB_STACK" and "FatfsMem_USB_MSD" components without RTOS into this PE. No "diskio.h" was generated.
4."khci_kinetis.c" is PE generated file where IAR gives the compiler errors in line 306 and line 620.
.
Thanks,
Rong
from mcuoneclipse.
You should be able to attach files to this ticket (at least I have an option if I post a comment).
Other than that: you can send it to my email address listed on http://mcuoneclipse.com/about/
from mcuoneclipse.
Dear Professor Erich,
Currently our company is closed for Thanksgivings Holiday, I could not access my office computer to send you the project files. I will do next Monday (11/30) for sure..
.
Thanks,
Rong
from mcuoneclipse.
Dear Professor Erich,
This place does not accept any zipped file
("Unfortunately, we don’t support that file type. Try again with a PNG, GIF, JPG, DOCX, PPTX, XLSX, TXT, or PDF").
I could not find your e-mail address in that link. Could you send it to me directly?
Two issues I have now:
-
Our PE did not generate "diskio.h" (I had to copy it from KSDK1.2.0 USB files - not 100% as same as your "diskio.h"). This problem is unrelated to IAR. Our PE is v10.4.2.
I loaded your "FSL_USB_STACK" and "FatfsMem_USB_MSD" components without RTOS into this PE. But no "diskio.h" was generated. -
"khci_kinetis.c" is PE generated file where IAR gives the compiler errors in line 306 and line 620.
Thank you very much for your help,
Rong
from mcuoneclipse.
Dear Professor Erich,
I found your e-mail address and sent the zipped PE project file to your e-mail address. Our PE is v10.4.2
Our entire IAR project file is too big to send. I just sent you our zipped PE files first.
I will try to send the entire zipped project file later if PE files are not enough for you to fix the problem.
Please let me know if you receive and what else you need.
Thank you very much for your help,
Rong
from mcuoneclipse.
I see now the problem.
The wrong name of the buffer is used by the FSL stack for IAR.
I have made a fix here:
ErichStyger/McuOnEclipse_PEx@0c206f4
You can apply this fix to your own version of the component. The file affected should be here on your machine:
C:\ProgramData\Processor Expert\PEXDRV_PE5_3\Drivers\FSL_USB_Stack\Host\source\driver\kinetis\khci_kinetis.c
So you can do the patch manually.
Then I was able to compile your project, but not able to link it because not all the needed sources are present in the zip file.
I hope this helps,
Erich
from mcuoneclipse.
Dear Professor Erich,
Thank you so much for your timely help.
Now I am able to compile the PE and the whole project.
Our PE did not generate "diskio.h", I copied it from KSDK1.2.0 USB files and added one line code. Hope you can verify its correctness - it is included in the files I sent.
Our USB application is rather simple - The USB device just occasionally reads one, only one, fixed file written by our firmware. Do you think it is going to work without RTOS? Our project does not use RTOS at all.
Thanks again, I will test it out after write the interface.
Rong
from mcuoneclipse.
Dear Professor Erich,
-
Is there any document specifying the interface between your USB code and our application?
-
Which USB initialization functions we must call when power up from our application?
-
Should our application main loop call "FsMSD1_AppTask()"?
Thank you very much,
Rong
from mcuoneclipse.
Please have a look at existing FatFS USB MSD Host examples, e.g. https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-K22F/FRDM-K22F_USB_MSD_Host
(that one is using FreeRTOS, but does not matter: you can do the same bare metal).
As documentation, see the Freescale USB stack v4.1.1 documentation (http://cache.freescale.com/files/microcontrollers/doc/support_info/USB_STACK_RELEASE_NOTES_V4.1.1.pdf and http://www.freescale.com/webapp/sps/download/license.jsp?colCode=USB_STACK_V4.1.1&location=null).
Diskio.h is generated by Fat_FileSystem component, you need to add this one so you have a file system.
from mcuoneclipse.
Dear Professor Erich,
"Diskio.h is generated by Fat_FileSystem component, you need to add this one so you have a file system." -
You can see we have "FatFsMem_USB_MSD" component in our PE.
Should we add "Fat_FileSystem component" as well, or replace "FatFsMem_USB_MSD" with "Fat_FileSystem component"? What else we need to add? This is very critical.
Thank you very much,
Rong
from mcuoneclipse.
Dear Professor Erich,
Another question: To do what we need (R/W one fixed file), how many USB components (Minimum)in your LIB we need to add in our project???
Currently we have "FSL_USB_STACK" and "FatfsMem_USB_MSD" components. When I tried to add "Fat_FileSystem component", I got a lot of syntax error.
Thank you very much,
Rong
from mcuoneclipse.
Dear Professor Erich,
(Continue) When I said "I got a lot of syntax error When I tried to add "Fat_FileSystem component"", I meant the errors are generated by PE, not IAR,
You have our PE project files. You may see them using PE v10.4.2.
Thank you very much for your help,
Rong
from mcuoneclipse.
Hi Rong,
Could you use the Kinetis Design Studio project () as a reference, e.g. this project here:
I ask because you need to carefully configure the USB clock (which was not the case in the project you had sent to me).
You need:
- FSL_USB_Stack with FSL_USB_MSD_Host as sub component
- FatFsMem_USB_MSD to handle the USB MSD interaction with FatFS
- FAT_FileSystem as imlementation of the File System with FatFsMem_USB_MSD as Drive0
I hope this helps,
Erich
from mcuoneclipse.
Dear Professor Erich,
Our CPU PE configuration already set USB clock as 48MHz in our application project, which you have.
"Could you use the Kinetis Design Studio project () as a reference, e.g. this project here:"
Which one? Please advise.
When load the third component "•FAT_FileSystem " into our PE, we got a lot of syntax errors in PE. You have our PE project and you will get the same syntax errors when load the "•FAT_FileSystem ". Maybe this component also try to initialize the clock, which has be done by our CPU PE component?
Thank you very much for your help,
Rong
from mcuoneclipse.
Here are projects:
https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-K20D50M/FRDM-K20_MSD_Host
https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-K64F120M/FRDM-K64F_USB_MSD_Host
https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-K22F/FRDM-K22F_USB_MSD_Host
And only the USB Init will configure the USB clock, but you need to have as well the clock configured in the CPU component. I suggest that you have a look at the above projects.
I hope this helps,
Erich
from mcuoneclipse.
Dear Professor Erich,
I will do my homework by studying the projects.
Thank you very much for your help,
Rong
from mcuoneclipse.
Dear Professor Erich,
I have been busy on other work. Now I am back.
1. Are the links below are PE based USB application projects using your components?
2. How to download the zipped projects?
Thanks,
Rong
Here are projects:
https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-K20D50M/FRDM-K20_MSD_Host
https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-K64F120M/FRDM-K64F_USB_MSD_Host
https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-K22F/FRDM-K22F_USB_MSD_Host
from mcuoneclipse.
- Yes, they are using McuOnEclipse projects
- There is a 'download zip' button on the root of every repository page: go to https://github.com/ErichStyger/mcuoneclipse and there is https://github.com/ErichStyger/mcuoneclipse/archive/master.zip
from mcuoneclipse.
Dear Professor Erich,
I did download the zip file. There are two projects: "FRDM-K20D50M" and "FRDM-KL25Z" under IAR. I do not see "FRDM-K64F_USB_MSD_Host".
Is this zip file the right and only file I need under IAR?
Thanks,
Rong
from mcuoneclipse.
Dear Professor Erich,
I used the link in your mail to down load the zipped file.
But when I viewed the project's PE project (Under Example Project IAR directory), I do not see any USB component there (I expect three USB components).
May be I did not get the right zip file?
Thank you very much for your help,
Rong
from mcuoneclipse.
Dear Professor Erich,
I was following your KDS example PE project to import and configure your 3 USB components in my PE project. So far I am able to compile the project under PE successfully. I will try to compile it under IAR later.
Thanks,
Rong
from mcuoneclipse.
Dear Professor Erich,
I am able to configure and compiler the project now.
I added "i = FAT1_Init();" and "i = FsMSD1_HostInit();" into my initial routine in my main project.
Also I added FsMSD1_AppTask(); into my main loop in my main project (main.c)
However when I plug USB into my prototype board, I expect the program breaks out in the break point set in (FsMSD1_AppTask(); USB_DEVICE_ATTACHED). But it breaks out in below (cpu.c) without any break point set.
PE_ISR(Cpu_Interrupt)
{
/* This code can be changed using the CPU bean property "Build Options / Unhandled int code" /
/ asm (HALT) */
}
Could you advise me how to fix it? What I missed here?
Thank you very much and wish you Merry Christmas and Happy Holidays,
Rong
from mcuoneclipse.
Hello Rong,
are you still using IAR for this? I suggest that you start with Kinetis Design Studio and the project as on GitHub so you have a working environment. Once you have that working, you can consider doing this with IAR. Because otherwise there are far too many variables and things which can go wrong with the IAR environment.
As for the unknown interrupt: See the following post and how to enable interrupt handlers so you know which interrupt is causing the problem for you:
http://mcuoneclipse.com/2012/02/20/oh-my-an-interrupt/
Merry Christmas and Happy Holidays,
Erich
from mcuoneclipse.
Dear Professor Erich,
After I changed to "Own handler for every" in CPU component configuration in PE, the fault is caused by "Cpu_ivINT_Hard_Fault"
Could it be caused by some task stack size defined too low and it needs to be increased? How can I trace it from here for "Cpu_ivINT_Hard_Fault"?
I will try to use KDS.
Thanks,
Rong
from mcuoneclipse.
Hi Rong,
I have a few helpers and articles around hard faults here:
http://mcuoneclipse.com/2012/11/24/debugging-hard-faults-on-arm-cortex-m/
http://mcuoneclipse.com/2015/07/05/debugging-arm-cortex-m-hard-faults-with-gdb-custom-command/
http://mcuoneclipse.com/2012/12/28/a-processor-expert-component-to-help-with-hard-faults/
I hope this helps,
Erich
from mcuoneclipse.
Dear Professor Erich,
I found "OTG_BUILD" is not defined in the generated code, and there is no code inside
USB_ISR(void). That may be why CPU Interrupt Error occurs? Should "OTG_BUILD" be defined?
Otherwise there should be the code inside USB_ISR(void). Right? Thanks Rong
Refer to:
#ifdef OTG_BUILD
void USB_ISR_HOST(void)
#else
void USB_ISR(void)
#endif
from mcuoneclipse.
Yes, that's correct: OTG_BUILD does not have to be defined.
The USB interrupt function is defined with
void USB_ISR(void)
in khci_kinetis.c, line 1093.
I hope this helps,
Erich
from mcuoneclipse.
Dear Professor Erich,
Thanks,.
I believer before the CPU Interrupt Error occurs (Whenever USB sticker
is plugged in), the program was running in USB_ISR(void) first. I have to
set the break point there to trice where the exception occurs and why.
Right?
Since the office is closed, I have to wait until 2016.
Thank you for your help,
Happy New Year!
Rong
On Tue, Dec 29, 2015 at 10:53 AM, Erich Styger [email protected]
wrote:
Yes, that's correct: OTG_BUILD does not have to be defined.
The USB interrupt function is defined with
void USB_ISR(void)
in khci_kinetis.c, line 1093.I hope this helps,
Erich—
Reply to this email directly or view it on GitHub
#24 (comment)
.
from mcuoneclipse.
Dear Professor Erich,
I just came back to this task today.
Once the USB attachment is detected, the program does break in "USB_ISR".
However the program got into "WAIT1_Waitms(delay);" listed at the end of this comment. Why???
"void time_delay(uint_32 delay)" may cause the CPU interrupt error.
Should "void time_delay(uint_32 delay)" be used?
Thank you very much for your help,
Rong
void time_delay(uint_32 delay) {
#if 1 /* too inaccurate? /
WAIT1_Waitms(delay);
#else
extern volatile long delay_count; / needs to be incremented in Events.c by a 1 ms timer */
delay_count = 0;
while(delay_count<delay) {
/* wait */
}
#endif
}
Thank you for your help,
Rong
from mcuoneclipse.
Yes, that version works for me. But you are free to use any other method for the delay if you want.
Best regards,
Erich
from mcuoneclipse.
eric can you delete me from the mailing list
Electronics Eng.
Erdem KÖSE
2016-01-15 13:29 GMT+02:00 Erich Styger [email protected]:
Yes, that version works for me. But you are free to use any other method
for the delay if you want.Best regards,
Erich—
Reply to this email directly or view it on GitHub
#24 (comment)
.
from mcuoneclipse.
I cannot do that. You have unsubscribe yourself I think.
from mcuoneclipse.
It was from "erdemkose78"
On Fri, Jan 15, 2016 at 7:57 AM, Erich Styger [email protected]
wrote:
I cannot do that. You have unsubscribe yourself I think.
—
Reply to this email directly or view it on GitHub
#24 (comment)
.
from mcuoneclipse.
Dear Professor Erich,
I am trying to trace where the CPU interrupt fault ("PE_ISR(Cpu_ivINT_Hard_Fault)") came from by following the link
http://mcuoneclipse.com/2012/11/24/debugging-hard-faults-on-arm-cortex-m/
I insert the code below as instructed by the above link:
attribute_((naked))
PE_ISR(Cpu_ivINT_Hard_Fault)
{
__asm volatile (
" movs r0,#4 \n"
" movs r1, lr \n"
" tst r0, r1 \n"
" beq _MSP \n"
" mrs r0, psp \n"
" b _HALT \n"
"_MSP: \n"
" mrs r0, msp \n"
"_HALT: \n"
" ldr r1,[r0,#20] \n"
" bkpt #0 \n"
);
}
However IAR gives the compiler errors on "attribute((naked));"
Error[Pe079]: expected a type specifier C:\Doc\USB\USB-PC_Demo\PC_GUI_DEMO\Source\InputOutputPCB\Application\PE\Generated_Code\Cpu.c 153
Error[Pe260]: explicit type is missing ("int" assumed) C:\Doc\USB\USB-PC_Demo\PC_GUI_DEMO\Source\InputOutputPCB\Application\PE\Generated_Code\Cpu.c 153
Error while running C/C++ Compiler
Do you know how why?
Thanks,
Rong
from mcuoneclipse.
Dear Professor,
I use "irq __arm PE_ISR(Cpu_ivINT_Hard_Fault);" to replace __attribute((naked)) under IAR.
But I found the asm code syntax may be different also under IAR.
Thanks,
Rong
from mcuoneclipse.
The Processor Expert component should work for IAR too. Have you tried that?
from mcuoneclipse.
Dear Professor,
I am using PE under IAR. When USB is inserted, It breaks in USB_ISR(void). However it went to
PE_ISR(Cpu_ivINT_Hard_Fault) shortly,
I try to add the assembly code in PE_ISR Hard_Fault to trace where it came from before getting into the Hard_Fault. I got the compiler errors on the assembly code copied from the link as below:
Error[Og010]: Inline assembler instruction has more than one size: " beq ??_MSP ". Use size specific syntax
Error[Og010]: Inline assembler instruction has more than one size: " b ??_HALT ". Use size specific syntax
Thanks,
Rong
Thanks,
Rong
from mcuoneclipse.
It does work with the Kinetis Design Studio IDE and compiler, correct? It might be a problem with the IAR compiler. I'm affraid that I won't be able to help you much (if any) for IAR because this is not what I can use :-(
from mcuoneclipse.
Dear Professor Erich,
We do not use KDS. The code was copied from the links you gave.
The only problem is in the branch statement. IAR does not like the two branches. Other syntax seems OK if I get rid of the branches. However I need to find out how to write the branch under IAR.
I will ask IAR for help.
Thanks,
Rong
from mcuoneclipse.
I use "irq __arm PE_ISR(Cpu_ivINT_Hard_Fault);" to replace "_attribute((naked))"
It seems OK now.
However IAR compiler does not like the branch statement below
__asm volatile (
" movs r0,#4 \n"
" movs r1, lr \n"
" tst r0, r1 \n"
" beq _MSP \n"
" mrs r0, psp \n"
" b _HALT \n"
"_MSP: \n"
" mrs r0, msp \n"
"_HALT: \n"
" ldr r1,[r0,#20] \n"
" bkpt #0 \n"
);
Error[Og010]: Inline assembler instruction has more than one size: " beq ??_MSP ". Use size specific syntax
Error[Og010]: Inline assembler instruction has more than one size: " b ??_HALT ". Use size specific syntax
from mcuoneclipse.
Related Issues (20)
- FreeRTOS component fails to reload HOT 14
- SD_Card Component Doesn't allow selection of CS pin in SPIMaster_LDD HOT 1
- CodeWarrior 10.6 for MC9S08 C compiler don't have stdbool.h and stdint.h HOT 2
- InitUSB error with MKL26 with KSDK1.3 HOT 6
- CriticalSection bug HOT 10
- FreeRTOS compile issue HOT 13
- nRF24 project with KDS HOT 3
- Bad cast in gprof for arm HOT 3
- Weird Problem when snapshotting components HOT 2
- "Unknown macro" error when generating FreeRTOS component files HOT 1
- No re-enable interrupts HOT 2
- Don't name libraries this way! HOT 1
- Wifi driver for joystick HOT 1
- PPAGE handling in FreeRTOS port for HCS12X banked memory model HOT 6
- could you help me i meet a error when i use this script HOT 2
- SDRAM DCD Settings for the Arch Mix board HOT 1
- building tinyK22_RaspberryPi_UPS on linux: naming error HOT 1
- Cannot see anything in Image Info Tab of MCUXpressoIDE v11.2.1_4149? HOT 1
- minINI: writing to the sd card HOT 1
- McuSWO.c - SWO_PrintChar - The character is always sent to Stimulus port 0. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mcuoneclipse.