- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In PK1C20.h, <div class='quotetop'>QUOTE </div> --- Quote Start --- /*------------------------------------------------------------------------ * MEMORY ORGANIZATION * -Monitor at top. * -The heap is placed below the monitor. * -Global data is placed below the heap. * -The stack is placed below global data (&grows down). *----------------------------------------------------------------------*/# define CFG_MONITOR_LEN?(256 * 1024) /* Reserve 128k?*/# define CFG_GBL_DATA_SIZE 128?/* Global data size rsvd*/# define CFG_MALLOC_LEN?(CFG_ENV_SIZE + 128*1024) # define CFG_MONITOR_BASE TEXT_BASE# define CFG_MALLOC_BASE?(CFG_MONITOR_BASE - CFG_MALLOC_LEN)# define CFG_GBL_DATA_OFFSET (CFG_MALLOC_BASE - CFG_GBL_DATA_SIZE)# define CFG_INIT_SP?CFG_GBL_DATA_OFFSET[/b] --- Quote End --- I want to know clearly about the Monitor, heap, Global data, stack means and their functions. And How to set them in nios2 system? Thank you.Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi LiangYi,
The u-boot memory layout for the PK1C20 board is as follows: +--------------------+ (Top of SDRAM) | | u-boot code (256 KB = CFG_MONITOR_LEN) | +--------------------+ <== CFG_MONITOR_BASE, TEXT_BASE | | heap (128 KB = CFG_MALLOC_LEN) | +--------------------+ <== CFG_MALLOC_BASE | | global data (128 B = CFG_GBL_DATA_SIZE) | +--------------------+ <== CFG_GLB_DATA_OFFSET, CFG_INIT_SP | | STACK (Grows down) | The heap includes room for the ram-based environment (which is dynamically allocated) and copied from flash at startup. > And How to set them in nios2 system? Typically the monitor length is set to some value (2**n) that is larger than the u-boot memory footprint. In this case 256 KB ... which is almost twice what is required (depending on which features are configured in u-boot). The heap can be set to whatever value you like (subject to your actual memory resources). If you add your own commands and require a large heap, you can increase this. Many boards set this to 128 KB -- a good empirical starting point. Set the global data area to 128 -- the global data area is currently less than this ... and is very unlikely to change. The stack simply grows downward -- so it's a bad idea to tftpboot or loadb into memory just under the u-boot text ;-) The macros (which I agree are not the most readable) are set up so the size of the memory regions can be easily changed ... without changing the relative layout. Regards, --Scott
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page