Forum Discussion
Altera_Forum
Honored Contributor
22 years agoHpw do I change the startup adr of an app
Hi
I tried writing about this before. Hope someone can help me. I have a simple program. I want to change the startup adr of my program from 0x1000000(SDRAM base adr) to for an exsample 0x1100000. I have tried to define my own custom linker script in the system library. Here below I have copied in the changes I made to the default linker script ----------------------------------------------------------------------------------------------------- MEMORY { reset : ORIGIN = 0x00000000, LENGTH = 32 ext_flash : ORIGIN = 0x00000020, LENGTH = 8388576 ext_ram : ORIGIN = 0x00800000, LENGTH = 1048576 epcs_controller : ORIGIN = 0x00900000, LENGTH = 2048 sdram_UNUSED : ORIGIN = 0x01100000, LENGTH = 32 sdram : ORIGIN = 0x01100020, LENGTH = 15728640 } /* Define symbols for each memory base-address */ __alt_mem_ext_flash = 0x00000000 ; __alt_mem_ext_ram = 0x00800000 ; __alt_mem_epcs_controller = 0x00900000 ; __alt_mem_sdram = 0x01100000 ; ----------------------------------------------------------------------------------------------------- But when I use this script nothing really happens when I starte up the program. What am I missing??? Can this be done with this script or must it be done with the ELF tools???? If yes how with the ELF tools???? Hope someone can help me since the documentation for this is none existing Best regards GreateWhite.DK13 Replies
- Altera_Forum
Honored Contributor
The bootm command is now implemented. You'll also
need to get the mkimage utility to create the u-boot image file. Pre-builts, sources, etc updated at: http://www.psyent.com/download (http://www.psyent.com/download) I tested by booting a gzipped Microtronix linux kernel on the Altera 1C20 devkit board. Result were pretty good: vmlinux.bin: 1.6 MB (original binary) vmlinux.img: 678 KB (gzipped u-boot image). BTW: see the README in the mkimage zip file for instructions. Regards, --Scott - Altera_Forum
Honored Contributor
Hi Scott
Really nice that you have finished it. Have gotten my own loader up and running now and it runs super http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif Tried using your u-boot because you get a better compression from your GZip that I get from using my alogoritme.(I only get the 1.6MB to about 900k) But when I try starting up the u-boot as instructed in the readme file I get U-Boot 1.1.2 (Sep 17 2004 - 16:15:21) CPU : Nios-II SYSID : 948685d8, Wed Apr 28 05:53:44 2004 BOARD : Psyent PK-1C20 *** Warning - bad CRC, using default environment ==> So when I get some spare time I will take a more close look at it. Thx again for all your help Scott you have many buddy points in my book http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif Regards GreateWhite.DK - Altera_Forum
Honored Contributor
> *** Warning - bad CRC, using default environment
This is normal behavior when the environment has not been saved to flash. u-boot supports environment variables. These variables are simply name-value pairs. If you execute the 'printenv' command, you should see something like: stdin=serial stdout=serial ipaddr=192.168.2.21 You can add variables to the u-boot environment using the 'setenv' command. For example, to set the environment variable 'netmask' to '255.255.255.0': ==> setenv netmask 255.255.255.0 When u-boot starts up, it trys to read saved environment variables from a configured address. In the case of the PK1C20 configuration, it uses the flash sector at 0x0000_3000. The environment is stored as a 32-bit CRC, followed by strings formatted as "name=value\0". If the CRC is good, u-boot uses the variables from flash, otherwise it uses a set of default variables that are created at compile time. To save your environment to flash (and prevent subsequent warnings at startup), just use the 'saveenv' command. Provided that you flash programming implementation is correct, u-boot will copy the variables to flash and write the 32-bit CRC. The enviroment variables are quite handy for storing things such as serial numbers, default ip addresses, etc. They may also be used in commands and u-boot scripts. For example: ==> setenv serverip 10.0.41.40 ==> ping $serverip A more complicated example would be to set the bootcmd variable to load a kernel image via tftp, then boot the kernel. The bootcmd variable can be configured to automatically run at startup after a configured delay (in this case 5 seconds): ==> setenv bootcmd "tftpboot 800000 linux.img; bootm 800000" ==> setenv bootdelay 5 ==> saveenv Anyway, there's a long-winded description ;-) of some things you can do with the environment. Regards, --Scott