public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
From: Ilija Kocho <ilijak@siva.com.mk>
To: ecos-devel@ecos.sourceware.org
Subject: Re: STM32F107 on STM3210C-EVAL
Date: Mon, 28 Mar 2011 11:34:00 -0000	[thread overview]
Message-ID: <4D90723D.3040606@siva.com.mk> (raw)
In-Reply-To: <23118906-1707f2ce17e92d08d3084915122281bc@pkn7.m5r2.onet>

On 28.03.2011 11:51, qber_@poczta.onet.pl wrote:
> Hi
>
> W dniu 2011-03-26 12:07:30 użytkownik Ilija Kocho <ilijak@siva.com.mk> napisał:
>> On 23.03.2011 11:50, John Dallaway wrote:
>>> Hi Gian Maria
>>>
>>> Gian Maria wrote:
>>>
>>>> I'm porting eCos to STM3210C and I find a logical error on the
>>>> implementation of CYGPKG_HAL_CORTEXM_STM32.
>>>> CYGPKG_HAL_CORTEXM_STM32 must be the base of all STM32 uP and so is not
>>>> correct for me to use
>>>>
>>>>     cdl_option CYGHWR_HAL_CORTEXM_STM32 {
>>>>         display          "STM32 variant in use"
>>>>         flavor           data
>>>>         default_value    {"F103ZE"}
>>>>         legal_values     {"F103RC" "F103VC" "F103ZC"
>>>>                           "F103RD" "F103VD" "F103ZD"
>>>>                           "F103RE" "F103VE" "F103ZE" }
>>>>         description      "The STM32 has several variants, the main differences
>>>>                           being in the size of on-chip FLASH and SRAM
>>>>                           and numbers of some peripherals. This option
>>>>                           allows the platform HAL to select the specific
>>>>                           microcontroller fitted."
>>>>     }
>>>>
>>>> That is inside "ecoscvs\ecos\packages\hal\cortexm\stm32\var\current\cdl",
>>>> because with my EVB for example 
>>>> the uP is a STM32F107VC. With this I can't set the right uP as default for
>>>> the template.
>>>> I'm right? I think the correct is to put the code inside
>>>> "ecoscvs\ecos\packages\hal\cortexm\stm32\stm3210e_eval\current\cdl"
>>> I am not sure I understand your question. Are you intending to create a
>>> new platform HAL package for STM3210C-EVAL?
>>>
>>>> Can someone modify this so I can update my CVS and work with the right code?
>>> It will be no problem to extend the set of legal values for
>>> CYGHWR_HAL_CORTEXM_STM32. Of course, you can make this change in your
>>> local CVS checkout until you are ready to contribute your platform
>>> support for STM3210C-EVAL.
>> Current STM32 code, as is, would not work for single chip configuration
>> as it unconditionally depends on external RAM. In SIvA we have an
>> internal modification that enables single chip operation and if there is
>> an interest we would post a patch.
>>
> It seems from reference manual that STM32 familly is almost compatible. On page 40 (RM) there is table with diffrences. The main issue is the interenal RAM and FLASH memmory. The FLASH is not a big problem (probably code will work just fine - I'm working with STM32103VD with settings for VE), but the SRAM is a different matter. The stack is placed on the top of internal SRAM memmory so you have to change the size of internal SRAM. This can be done in \packages\hal\cortexm\stm32\stm3210e_eval\current\include\pkgconf *.ldi and *.h files. The build configuration for connectivity line have to be set to ROM (Startup type) because this chip doesn't support FSMC. Next thing to do is to modyfy the stm3210e_eval_misc.c (remove the FSMC section).
>
>
>     base = CYGHWR_HAL_STM32_GPIOA;
>     HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0x88888888 );
>     HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0x88888888 );
>     
>     base = CYGHWR_HAL_STM32_GPIOB;
>     HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0x88888888 );
>     HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0x88888888 );
>     
>     base = CYGHWR_HAL_STM32_GPIOC;
>     HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0x88888888 );
>     HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0x88888888 );
>     
>     base = CYGHWR_HAL_STM32_GPIOD;
>     HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0x88888888 );
>     HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0x88888888 );
>     
>     // Set up GPIO lines for external bus
>
> -    base = CYGHWR_HAL_STM32_GPIOE;
> -    HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0xbbbbb4bb );
> -    HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0xbbbbbbbb );
>
> -    base = CYGHWR_HAL_STM32_GPIOF;
> -    HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0x44bbbbbb );
> -   HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0xbbbb4444 );
>
> -    base = CYGHWR_HAL_STM32_GPIOG;
> -    HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0x44bbbbbb );
> -    HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0x44444bb4 );
>
>     
> -   // Set up FSMC NOR/SRAM bank 2 for NOR Flash
>
> -    base = CYGHWR_HAL_STM32_FSMC;
>
> -    HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_FSMC_BCR2, 0x00001059 );
> -    HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_FSMC_BTR2, 0x10000705 );
>
> -    // Set up FSMC NOR/SRAM bank 3 for SRAM
>
> -    HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_FSMC_BCR3, 0x00001011 );
> -    HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_FSMC_BTR3, 0x00000200 );
>
>

That's basically it. In addition in mlt files rename SRAM to RAM in
order to preserve GDB stubs / RedBoot functionality.

FSMC by default should be enabled (backward compatibility) for devices
that have it, but there should be an option to enforce disabling.

> There is only one thing left - the RCC differences. In RM there is a seperate section about RCC config for CL. But at the first look it seems that registers are compatible.
>
> Summary I think that for CL there is no need for creating new port but to modyfy existing one for new internal FLASH and SRAM and without FSMC module.
>
+1 from me. Changes to the variant are small and easy to implement.

Ilija

  parent reply	other threads:[~2011-03-28 11:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 19:15 Gian Maria
2011-03-23 10:51 ` John Dallaway
2011-03-26 11:07   ` Ilija Kocho
2011-03-28  9:55 ` qber_
2011-03-28 10:47   ` jerzy dyrda
2011-03-28 19:13     ` R: " Gian Maria
2011-03-28 11:34   ` Ilija Kocho [this message]
2011-04-14 10:59   ` mlazcoz
2011-03-23 10:30 qber_

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=4D90723D.3040606@siva.com.mk \
    --to=ilijak@siva.com.mk \
    --cc=ecos-devel@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).