Comments (9)
The issue started just with PPIDE, but actually I could get it to affect everything during testing.
SDCC is quite unpredictable where it puts stuff on the stack. Even changing the optimisation pressure can have a major effect on how the stack is managed. So initially I was getting reboots only with PPIDE, then failures just with PPIDE, then failures (depending on unknown stuff) everywhere.
I guess it just depended whether the specific stack position at the pointer address was being clobbered by another thing. The SD driver would certainly be using the stack differently, and that may have been the cause of the differing symptoms. But, I can't really tell.
from romwbw.
Surprising. Nothing occurs to me right off. It is certainly possible there was a regression in my code. I will do some regression testing today.
-Wayne
from romwbw.
I tried to recreate this issue using my SC126 and a PPIDE adapter. I used my FAT application under CP/M for testing just because I could do it quickly. The FAT application is based on FatFS. I had no problem repeatedly copying files to/from the FAT filesystem. Also no problem just copying from and to the FAT filesystem in a single operation. I did this with a 1MB file and tried repeatedly with no issues.
In the end, this doesn't mean too much because there are so many edge cases that are hard to take into account.
-
When your system restarts during a copy operation, does it do so near the start, middle, or end of the copy process?
-
I don't see anything strange in your code. It is substantially similar to the functions I use in the FAT application.
-
I note that you are using a much larger CF Card than I am. Not sure why that would matter though.
-
You are running under the debug monitor and I am running under CP/M. However, there are literally no CP/M calls involved when FAT.COM copies a file to & from the FAT partition.
I will think about this some more. Not immediately sure what to try next.
-Wayne
from romwbw.
Thanks for checking, Wayne.
I'll have to try breaking it down further to get a result.
Try some repeated reads, and repeated writes, perhaps.
I tried using the RC2014 last night too, with the same +hbios
target code. The result is similar, but there is no reboot. Instead it creates the file (with 0 bytes), and returns to dbgmon instead of copying.
The only "dog-walk thought" that occurred was there is something odd in my timer functions. They are being called directly before the copy action, so a fault there would result in a similar symptom.
from romwbw.
It occurred to me that I should try the FatFS I/O test module on a PPIDE device. I did this and it passed all tests repeatedly. I am still stumped. I hope you can find something.
-Wayne
from romwbw.
I've done a little more back to back testing, and seen the following.
- The reset issue has gone away.
Must have been doing something stupid, but the copy program is not working. - My simple mount-open-write-read test program works perfectly fine.
- Sometimes, the copy loop errors out on the first write, leaving one buffer full of data correctly written to the file.
- Mostly, the copy loop errors out on the first read, leaving 0 bytes copied.
Every time, the error is the same INVAILID_OBJECT. This error is generated (potentially) by the validate()
function, if the drive is not properly initialised (correct is return 0).
I am concerned that simply calling BF_DIOSTATUS
for disk_status()
may not be giving the expected 0 answer, if the drive is busy?
Otherwise, further work on this tonight.
Can only find one location where PPIDE_STAT
is set, and this doesn't seem to depend on whether the drive is busy or not. Odd.
from romwbw.
In theory, the only way that DIOSTATUS will return a non-zero result is if a prior I/O request failed. However, if that happened, you would have gotten an error from the I/O call itself. Sorry I don't have any ideas.
-Wayne
from romwbw.
OK. Kind of a learning experience.
The issue was nothing at all to do with what I suspected.
f_mount()
requires a pointer to a FATFS filesystem object.
Feeding it the address of a filesystem object is not sufficient.
That is one degree of abstraction too few, and boom, the filesystem object is invalid, so we get the error above.
Explains why my simple program worked properly (because it used malloc()
to allocate a FATFS filesystem object) but my copy program didn't do this (it just provided the address of a bss allocated filesystem object), and so it failed as the pointer containing the address filesystem object was just pushed onto the stack, and was later discarded.
Sorry for being thick.
from romwbw.
Ah, that does explain it. Glad you got it resolved! Kind of surprised it was only affecting things when the PPIDE driver was being used, but I have seen stranger things.
from romwbw.
Related Issues (20)
- configuring order of serial port detection / assignment HOT 2
- z180 - illegal opcode trap handler HOT 15
- RC2014 with SM Baker SIO-2 and CTC cards HOT 3
- CP/M 3 cpm2date Function Not Implemented HOT 1
- Question - ACIA & bugfixes in pre.50 & pre.55 HOT 8
- Getting a lot of build errors on CYGWIN HOT 11
- build errors on Lubuntu HOT 52
- CLRDIR does not wait for response HOT 16
- tasm not found when building dev under windows HOT 6
- Build fail HOT 6
- DDTZ and ZSID on z80 in interrupts running. HOT 18
- 3.1.1 UNA_std.rom fails on Mark IV HOT 2
- (Q) A new Release? HOT 7
- (Q) - freeRTOS context switch qualification HOT 4
- v3.0.1 Hangs before boot loader prompt HOT 13
- 3.0.0 does not compile on linux HOT 3
- CPM Tools HOT 2
- RomWBW Digital I/O Input at Startup HOT 9
- Survey.com HOT 19
- Multiple floppy drives with multiple media formats HOT 5
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 romwbw.