stm32 external SRAM

Christian Mauderer christian.mauderer at embedded-brains.de
Tue Jun 18 05:09:09 UTC 2019


On 18/06/2019 03:25, Jython wrote:
> my linkscmd is https://gist.github.com/goog/aad6dae4c418255dd6fb2b23bf2e6f08
> 
>     void BSP_START_TEXT_SECTION bsp_start_hook_1(void)
>     {
>       SRAM_fsmc_setup();
>       bsp_start_copy_sections();
>       bsp_start_clear_bss();
> 
>       /* At this point we can use objects outside the .start section */
>     }
> 
> 
> but now my code run disordered

Which one?

The SRAM_fsmc_setup()? In that case please note that you are in a very
early initialization step. So most system services won't work and global
variables are not initialized yet.

Or your later application code? In that case: Did you do a memory test
to check your RAM initialization? For example the routines from Michael
Barr from here work well:
http://www.esacademy.com/en/library/technical-articles-and-documents/miscellaneous/software-based-memory-testing.html

> 
> On Mon, Jun 17, 2019 at 2:45 PM Christian Mauderer
> <christian.mauderer at embedded-brains.de
> <mailto:christian.mauderer at embedded-brains.de>> wrote:
> 
>     If you put any sections into the external RAM that need initialization,
>     you have to init the RAM before the BSP copies it's sections. The STM32
>     BSP copies it's sections in bsp_start_hook_1(). So either put it in
>     bsp_start_hook_0 or in bsp_start_hook_1 before the copy_section calls.
>     Attention: You can't use much in these functions. They are in a very
>     early initialization stage. So be careful what you put there.
> 
>     If you only want malloc to allocate memory from there, there might is a
>     later point where you can do that.
> 
>     On 17/06/2019 08:32, Jython wrote:
>     > Thank you and the example! that is to say put extern sram init in
>     > bsp_start( void ) function?
>     >
>     > On Mon, Jun 17, 2019 at 1:04 PM Christian Mauderer
>     > <christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     > <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>> wrote:
>     >
>     >     On 17/06/2019 03:05, Jython wrote:
>     >     > STM32:
>     >     >     112KB at 2000 0000
>     >     >     16KB at 2001 C000
>     >     >
>     >     > external sram : 1MB at 0x68000000
>     >     >
>     >     >  does MEMORY layout support RAM2?
>     >
>     >     Hello Jython,
>     >
>     >     you can distribute the regions to the two RAMs. For example
>     this BSP
>     >     does that:
>     >
>     >   
>      https://git.rtems.org/rtems/tree/bsps/arm/lpc32xx/start/linkcmds.lpc32xx_phycore
>     >
>     >     Please note that you have to take a detailed look at what is
>     used till
>     >     your external RAM initialization run and what not. But if you
>     put your
>     >     external RAM initialization in an early enough step, you
>     shouldn't get
>     >     problems with that.
>     >
>     >     Best regards
>     >
>     >     Christian
>     >
>     >     >
>     >     > On Fri, Jun 14, 2019 at 10:13 PM Christian Mauderer
>     >     > <christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>
>     >     > <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>>> wrote:
>     >     >
>     >     >     If you have already added the chip and it is initialized
>     >     during startup,
>     >     >     you most likely have to add a section for it in your linker
>     >     command
>     >     >     file. Depending on where your internal RAM is located and
>     >     where the
>     >     >     external one is: If they are continuous that can be enough.
>     >     >
>     >     >     Best regards
>     >     >
>     >     >     Christian
>     >     >
>     >     >     On 14/06/2019 04:42, Jython wrote:
>     >     >     > we have added 1M ram by FSMC,  and want to manage it by
>     >     system malloc
>     >     >     > controler
>     >     >     >
>     >     >     > On Fri, Jun 14, 2019 at 10:26 AM Mr. Andrei Chichak
>     >     >     <groups at chichak.ca <mailto:groups at chichak.ca>
>     <mailto:groups at chichak.ca <mailto:groups at chichak.ca>>
>     >     <mailto:groups at chichak.ca <mailto:groups at chichak.ca>
>     <mailto:groups at chichak.ca <mailto:groups at chichak.ca>>>
>     >     >     > <mailto:groups at chichak.ca <mailto:groups at chichak.ca>
>     <mailto:groups at chichak.ca <mailto:groups at chichak.ca>>
>     >     <mailto:groups at chichak.ca <mailto:groups at chichak.ca>
>     <mailto:groups at chichak.ca <mailto:groups at chichak.ca>>>>> wrote:
>     >     >     >
>     >     >     >     A 407 doesn’t normally have external RAM.
>     >     >     >
>     >     >     >     ARMs have flash at 0 and the 407 has RAM at 0x2000
>     0000
>     >     as you
>     >     >     >     discussed earlier.
>     >     >     >
>     >     >     >     If you want to work with external flash or RAM,
>     you have
>     >     to set up
>     >     >     >     the FSMC or FMC to support it, but that isn’t a
>     part of
>     >     the dev
>     >     >     >     board that Sebastian used for the BSP port.
>     >     >     >
>     >     >     >     The external memory is going to be very specific
>     to your
>     >     board.
>     >     >     >     Which board are you working with?
>     >     >     >
>     >     >     >     A
>     >     >     >
>     >     >     >     > On 2019-June-13, at 06:23, Christian Mauderer
>     >     >     >     <christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>
>     >     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>>
>     >     >     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>
>     >     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>>>> wrote:
>     >     >     >     >
>     >     >     >     > On 05/06/2019 02:55, Jython wrote:
>     >     >     >     >> Hello!
>     >     >     >     >>
>     >     >     >     >>     2. In the normal (non-debugging) case, the
>     linker
>     >     >     script still
>     >     >     >     >>        places the
>     >     >     >     >>
>     >     >     >     >>    .text section near zero, but places the
>     start of the
>     >     >     .data and
>     >     >     >     .bss
>     >     >     >     >>    sections at the start location of the MPC555's
>     >     internal
>     >     >     RAM. The
>     >     >     >     >>    system startup code then configures the external
>     >     RAM just
>     >     >     >     after the
>     >     >     >     >>    internal RAM in memory, forming one large block
>     >     from the
>     >     >     two RAM
>     >     >     >     >>    devices.
>     >     >     >     >>
>     >     >     >     >> from https://devel.rtems.org/wiki/TBR/BSP/Ss555
>     >     >     >     >>
>     >     >     >     >> but i dont know how to configure the external
>     RAM just
>     >     >     after the
>     >     >     >     >> internal RAM in memory?
>     >     >     >     >> hope you could give me some guide!
>     >     >     >     >> 
>     >     >     >     >>
>     >     >     >     >
>     >     >     >     > Hello Jython,
>     >     >     >     >
>     >     >     >     > the documentation you linked is for an MPC. But your
>     >     subject
>     >     >     line
>     >     >     >     > mentions an STM32. What controller / BSP are you
>     using?
>     >     >     >     >
>     >     >     >     > Best regards
>     >     >     >     >
>     >     >     >     > Christian Mauderer
>     >     >     >     > --
>     >     >     >     > --------------------------------------------
>     >     >     >     > embedded brains GmbH
>     >     >     >     > Herr Christian Mauderer
>     >     >     >     > Dornierstr. 4
>     >     >     >     > D-82178 Puchheim
>     >     >     >     > Germany
>     >     >     >     > email: christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>
>     >     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>>
>     >     >     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>
>     >     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>>>
>     >     >     >     > Phone: +49-89-18 94 741 - 18
>     >     >     >     > Fax:   +49-89-18 94 741 - 08
>     >     >     >     > PGP: Public key available on request.
>     >     >     >     >
>     >     >     >     > Diese Nachricht ist keine geschäftliche
>     Mitteilung im
>     >     Sinne
>     >     >     des EHUG.
>     >     >     >     > _______________________________________________
>     >     >     >     > users mailing list
>     >     >     >     > users at rtems.org <mailto:users at rtems.org>
>     <mailto:users at rtems.org <mailto:users at rtems.org>>
>     >     <mailto:users at rtems.org <mailto:users at rtems.org>
>     <mailto:users at rtems.org <mailto:users at rtems.org>>>
>     >     >     <mailto:users at rtems.org <mailto:users at rtems.org>
>     <mailto:users at rtems.org <mailto:users at rtems.org>>
>     >     <mailto:users at rtems.org <mailto:users at rtems.org>
>     <mailto:users at rtems.org <mailto:users at rtems.org>>>>
>     >     >     >     > http://lists.rtems.org/mailman/listinfo/users
>     >     >     >
>     >     >     >
>     >     >     > _______________________________________________
>     >     >     > users mailing list
>     >     >     > users at rtems.org <mailto:users at rtems.org>
>     <mailto:users at rtems.org <mailto:users at rtems.org>>
>     >     <mailto:users at rtems.org <mailto:users at rtems.org>
>     <mailto:users at rtems.org <mailto:users at rtems.org>>>
>     >     >     > http://lists.rtems.org/mailman/listinfo/users
>     >     >     >
>     >     >
>     >     >     --
>     >     >     --------------------------------------------
>     >     >     embedded brains GmbH
>     >     >     Herr Christian Mauderer
>     >     >     Dornierstr. 4
>     >     >     D-82178 Puchheim
>     >     >     Germany
>     >     >     email: christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>
>     >     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>>
>     >     >     Phone: +49-89-18 94 741 - 18
>     >     >     Fax:   +49-89-18 94 741 - 08
>     >     >     PGP: Public key available on request.
>     >     >
>     >     >     Diese Nachricht ist keine geschäftliche Mitteilung im Sinne
>     >     des EHUG.
>     >     >
>     >
>     >     --
>     >     --------------------------------------------
>     >     embedded brains GmbH
>     >     Herr Christian Mauderer
>     >     Dornierstr. 4
>     >     D-82178 Puchheim
>     >     Germany
>     >     email: christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     >     <mailto:christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>>
>     >     Phone: +49-89-18 94 741 - 18
>     >     Fax:   +49-89-18 94 741 - 08
>     >     PGP: Public key available on request.
>     >
>     >     Diese Nachricht ist keine geschäftliche Mitteilung im Sinne
>     des EHUG.
>     >
> 
>     -- 
>     --------------------------------------------
>     embedded brains GmbH
>     Herr Christian Mauderer
>     Dornierstr. 4
>     D-82178 Puchheim
>     Germany
>     email: christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     Phone: +49-89-18 94 741 - 18
>     Fax:   +49-89-18 94 741 - 08
>     PGP: Public key available on request.
> 
>     Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> 

-- 
--------------------------------------------
embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.mauderer at embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list