Jonathan Larmour wrote: > diff -u -5 -p -r1.43 ChangeLog > --- packages/io/flash/current/ChangeLog 25 Feb 2006 14:07:43 -0000 1.43 > +++ packages/io/flash/current/ChangeLog 18 Nov 2008 00:54:12 -0000 > @@ -1,20 +1,314 @@ > -2006-02-21 Oliver Munz > - Andrew Lunn > > - * src/flash.c (flash_init): Allow repeat calls change the function > - used for printing. There are times you don't any output, eg you > - are downloading am image over the serial port. About this bit. This patch which had been in the trunk couldn't be merged directly. Instead I am applying the attached patch to replace it. This is worthy of separate comment as it seems to subvert the principle of having different printf functions per device - otherwise what's the point? Perhaps this patch shouldn't be applied? I did in fact raise this issue (naffness of single printf function at init time) way back when the Flash v2 API was under discussion. I'll raise it again here. Here's what I wrote about it: -=-=-=-=-=-- [Remove printf function argument entirely from cyg_flash_init, and then...] Why not use a global constructor and have a function to only set the printf function away from the default. That function could also interpret NULL to be to set to a dummy empty function (like src/flashiodev.c does) Could also then do away with all CYG_FLASH_ERR_NOT_INIT checks (or relegate to an assert as it really should never happen) It also similarly simplifies flashiodev.c as then it doesn't have to check for init as well. -=-=-=-=-=-=- To which Bart validly replied: -=-=-=-=-=-=- I raised it with Andrew back in July. Unfortunately it is not currently possible. The currently defined constructor priorities are not sufficiently flexible to cope with dataflash, where the flash subsystem cannot be initialized until after the SPI bus. It would be necessary to reorganize the defined priorities, which is not something to be tackled lightly. -=-=-=-=-=-=- Unfortunately discussion fizzled out. My bad. However we've been happily using JFFS2, which uses the flashiodev stuff. That inits things at CYG_INIT_IO priority (49000). Obviously it doesn't use the dataflash, but it has been used in configurations where the dataflash is part of what has to be initted. From what Bart says, this has been risky, and potentially has depended on link order. We haven't seen this in practice, but I can believe it given both the flashiodev init priority and the SPI init priority are both CYG_INIT_IO, so the order depends on the whim of the linker. However given our experience and absence of problems in practice, it would seem low-risk to be tackling priorities. At least, if Bart is right, then there's already a problem, so we can hardly do nothing. Therefore as a starting point for discussion, I would suggest a new priority CYG_INIT_IO_BUS at 48000, i.e. before CYG_INIT_IO. This way buses can be initialised before devices which use them. Should we do this? Before eCos 3.0 would be the last chance to be fiddling with the flash API. Jifl -- eCosCentric Limited http://www.eCosCentric.com/ The eCos experts Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571 Registered in England and Wales: Reg No 4422071. ------["Si fractum non sit, noli id reficere"]------ Opinions==mine