From: bugzilla-daemon@bugs.ecos.sourceware.org
To: ecos-patches@ecos.sourceware.org
Subject: [Bug 1001561] Internal flash driver for Freescale TWR-K60N512 board
Date: Tue, 26 Jun 2012 09:31:00 -0000 [thread overview]
Message-ID: <20120626093123.B180E2F78003@mail.ecoscentric.com> (raw)
In-Reply-To: <bug-1001561-104@http.bugs.ecos.sourceware.org/>
Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001561
--- Comment #25 from Nicolas Aujoux <nau@csm-instruments.com> 2012-06-26 10:31:10 BST ---
(In reply to comment #21)
> Hi Nicolas
>
> I'm sorry for late reply, but I was busy. I tried to disable keeping Redboot
> configuration data in FLASH bit it still raises exception. Can you post your
> ECM file?
No problem. I posted a working for me configuration. I hope this works for you
as well.
>
> (In reply to comment #20)
> > Hi Ilija,
> >
> > I have made some tests and in order for the driver to work, I desactivated the
> > "Redboot FIS support" (in Redboot ROM monitor -> Allow RedBoot tu support FLASH
> > programming) and desactivated the "Keep Redboot configuration data in flash"
> > option.
> > When this options are enabled, Redboot try to read a portion of flash (with a
> > memcpy) which leads to a problem.
>
> Have you tried with cyg_flash_read()? It is recommended in manual and I would
> recommend too.
I found out something about that : it seems to come from th "Flash block
containing the directory" option which has the value "-1". This value should
correspond to the last block of flash but when I put the value to 2, I get a
prompt and the fis command (even if it still crash when I do a fis init).
>
> >
> > I also try to move the CYG_FLASH_DRIVER into a new kinetis_flash.c file and add
> > it to the file to be compile in the .cdl file. Redboot builds fine with it but
> > when I launch it, it seems that there is no flash init done. I'll keep working
> > on that but if you have any idea of what I am missing ...
>
> Probably the object file containing CYG_FLASH_DRIVER has been discarded by the
> linker since effectively there aren't references to it.
> If the driver is general for all Kinetis devices you can leave it in
> kinetis_misc.c or put it in kinetis_flash.inl and include in kinetis_misc.c.
> Otherwise you can put copies in platforms (see STM32 for example). However
> driver inclusion for compilation should be conditional with some #ifdef.
So I let it where it is for the moment. Thanks
>
> Ilija
(In reply to comment #24)
> (In reply to comment #23)
> > (In reply to comment #21)
> > > Hi Nicolas
> > >
> > > I'm sorry for late reply, but I was busy. I tried to disable keeping Redboot
> > > configuration data in FLASH bit it still raises exception. Can you post your
> > > ECM file?
> >
> > No problem. I posted a working for me configuration. I hope this works for you
> > as well.
>
> Thanks. I did some testing.
>
> >
> > >
> > > (In reply to comment #20)
> > > > Hi Ilija,
> > > >
> > > > I have made some tests and in order for the driver to work, I desactivated the
> > > > "Redboot FIS support" (in Redboot ROM monitor -> Allow RedBoot tu support FLASH
> > > > programming) and desactivated the "Keep Redboot configuration data in flash"
> > > > option.
> > > > When this options are enabled, Redboot try to read a portion of flash (with a
> > > > memcpy) which leads to a problem.
> > >
>
> The end address in CYG_FLASH_DRIVER is 1 byte too high and it triggers
> exception when you FIS directory and fconfig are at end of the FLASH.
> It should be
>
> (CYGMEM_REGION_flash + CYGMEM_REGION_flash_SIZE - 1)
Thanks for pointing that out.
>
>
> Also I think that for the time being we should protect Redboot from overwriting
> itself (and prevent writing to FLASH security area (0x400..0x40f).
> Note this can be the reason for your system freeze when you put FIS directory
> at beginning of FLASH. Something like this:
>
> #define REDBOOT_IMAGE_SIZE CYGBLD_REDBOOT_MIN_IMAGE_SIZE
>
> cyg_kinetis_flash_dev hal_kinetis_flash_priv;
> static const cyg_flash_block_info_t cyg_flash_kinetis_block_info[1] = {
> { KINETIS_FLASH_BLOCK_SIZE, (CYGMEM_REGION_flash_SIZE -
> REDBOOT_IMAGE_SIZE)/
> KINETIS_FLASH_BLOCK_SIZE }};
>
> CYG_FLASH_DRIVER(hal_kinetis_flash,
> &cyg_kinetis_flash_funs,
> 0,
> CYGMEM_REGION_flash + REDBOOT_IMAGE_SIZE,
> (CYGMEM_REGION_flash + CYGMEM_REGION_flash_SIZE - 1),
> 1, //number of block info
> cyg_flash_kinetis_block_info,
> &hal_kinetis_flash_priv);
>
> With this configuration it works with default configuration. But I have tried
> fconfig -i and fis init and it fails to write. Here is the "fconfig -i" minicom
> output:
>
> RedBoot> fconfig -i
> Initialize non-volatile configuration - continue (y/n)? y
> Run script at boot: false
> Use BOOTP for network configuration: false
> Gateway IP address: 192.168.209.1
> Local IP address: 192.168.209.77
> Local IP address mask: 255.255.255.0
> Default server IP address: 192.168.209.7
> Console baud rate: 38400
> GDB connection port: 9000
> Force console for special debug messages: false
> Network debug at boot time: false
> Update RedBoot non-volatile configuration - continue (y/n)? y
> ... Erase from 0x0007e000-0x0007efff: ..
> ... Program from 0x2000d800-0x2000e800 to 0x0007e000: V
> Error writing config data at 0x0007e000: Data verify failed after operation
>
The problem here is that in my driver, I expect a relative address in flash so
I substract the flash base to the address and thus the program command actually
programs the address minus 0x20000. Anyway, my bad, I will post a patch to
correct this.
>
> >
> > I found out something about that : it seems to come from th "Flash block
> > containing the directory" option which has the value "-1". This value should
> > correspond to the last block of flash but when I put the value to 2, I get a
> > prompt and the fis command (even if it still crash when I do a fis init).
> >
> > >
> > > >
> > > > I also try to move the CYG_FLASH_DRIVER into a new kinetis_flash.c file and add
> > > > it to the file to be compile in the .cdl file. Redboot builds fine with it but
> > > > when I launch it, it seems that there is no flash init done. I'll keep working
> > > > on that but if you have any idea of what I am missing ...
> > >
> > > Probably the object file containing CYG_FLASH_DRIVER has been discarded by the
> > > linker since effectively there aren't references to it.
> > > If the driver is general for all Kinetis devices you can leave it in
> > > kinetis_misc.c or put it in kinetis_flash.inl and include in kinetis_misc.c.
> > > Otherwise you can put copies in platforms (see STM32 for example). However
> > > driver inclusion for compilation should be conditional with some #ifdef.
> >
> > So I let it where it is for the moment. Thanks
>
> For the time being you could leave it, but for the permanent
>
>
> >
> > >
> > > Ilija
--
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
next prev parent reply other threads:[~2012-06-26 9:31 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-12 14:39 [Bug 1001561] New: " bugzilla-daemon
2012-04-12 17:43 ` [Bug 1001561] " bugzilla-daemon
2012-04-19 13:12 ` bugzilla-daemon
2012-04-19 13:13 ` bugzilla-daemon
2012-04-19 13:14 ` bugzilla-daemon
2012-04-19 13:35 ` bugzilla-daemon
2012-04-19 15:37 ` bugzilla-daemon
2012-04-22 16:34 ` bugzilla-daemon
2012-04-22 16:34 ` bugzilla-daemon
2012-05-02 7:39 ` bugzilla-daemon
2012-05-02 7:39 ` bugzilla-daemon
2012-05-02 8:27 ` bugzilla-daemon
2012-05-02 15:13 ` bugzilla-daemon
2012-05-02 15:18 ` bugzilla-daemon
2012-05-02 15:20 ` bugzilla-daemon
2012-05-02 16:02 ` bugzilla-daemon
2012-05-10 13:52 ` bugzilla-daemon
2012-05-10 14:26 ` bugzilla-daemon
2012-05-10 17:08 ` bugzilla-daemon
2012-05-15 6:22 ` bugzilla-daemon
2012-05-15 8:42 ` bugzilla-daemon
2012-05-15 12:09 ` bugzilla-daemon
2012-05-21 15:01 ` bugzilla-daemon
2012-05-29 6:53 ` bugzilla-daemon
2012-06-20 7:49 ` bugzilla-daemon
2012-06-20 14:11 ` bugzilla-daemon
2012-06-20 14:34 ` bugzilla-daemon
2012-06-21 7:01 ` bugzilla-daemon
2012-06-23 16:39 ` bugzilla-daemon
2012-06-26 9:31 ` bugzilla-daemon [this message]
2012-06-28 7:56 ` bugzilla-daemon
2012-06-28 7:57 ` bugzilla-daemon
2012-07-10 9:02 ` bugzilla-daemon
2012-07-10 13:21 ` bugzilla-daemon
2012-07-10 13:21 ` bugzilla-daemon
2012-07-10 13:25 ` bugzilla-daemon
2012-07-10 15:47 ` bugzilla-daemon
2012-07-11 5:14 ` bugzilla-daemon
2012-07-11 7:12 ` bugzilla-daemon
2012-07-11 11:42 ` bugzilla-daemon
2012-07-11 14:41 ` bugzilla-daemon
2012-07-14 16:26 ` bugzilla-daemon
2012-07-18 14:11 ` bugzilla-daemon
2012-07-18 14:11 ` bugzilla-daemon
2012-07-18 14:28 ` bugzilla-daemon
2012-07-20 11:26 ` bugzilla-daemon
2012-08-07 13:16 ` bugzilla-daemon
2012-08-07 13:19 ` bugzilla-daemon
2012-08-07 13:23 ` bugzilla-daemon
2012-09-24 14:34 ` bugzilla-daemon
2012-09-25 16:23 ` bugzilla-daemon
2012-09-25 20:17 ` bugzilla-daemon
2012-09-26 12:30 ` bugzilla-daemon
2012-09-26 12:30 ` bugzilla-daemon
2012-09-26 14:42 ` bugzilla-daemon
2012-09-26 15:49 ` bugzilla-daemon
2012-09-27 8:06 ` bugzilla-daemon
2012-09-27 18:26 ` bugzilla-daemon
2012-09-27 18:29 ` bugzilla-daemon
2012-09-27 18:39 ` bugzilla-daemon
2012-09-28 16:15 ` bugzilla-daemon
2012-09-28 19:06 ` bugzilla-daemon
2012-11-04 14:33 ` bugzilla-daemon
2012-11-04 14:34 ` bugzilla-daemon
2012-11-04 14:35 ` bugzilla-daemon
2012-11-04 14:36 ` bugzilla-daemon
2012-11-04 14:39 ` bugzilla-daemon
2013-02-11 15:01 ` bugzilla-daemon
2017-02-15 7:24 ` bugzilla-daemon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120626093123.B180E2F78003@mail.ecoscentric.com \
--to=bugzilla-daemon@bugs.ecos.sourceware.org \
--cc=ecos-patches@ecos.sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).