{"action":"created","issue":{"url":"https://api.github.com/repos/mcoquelin-stm32/afboot-stm32/issues/1","labels_url":"https://api.github.com/repos/mcoquelin-stm32/afboot-stm32/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/mcoquelin-stm32/afboot-stm32/issues/1/comments","events_url":"https://api.github.com/repos/mcoquelin-stm32/afboot-stm32/issues/1/events","html_url":"https://github.com/mcoquelin-stm32/afboot-stm32/issues/1","id":126345631,"number":1,"title":"clock_setup() bug, and a question on SDRAM initialization for the kernel","user":{"login":"henrychoi","id":1668540,"avatar_url":"https://avatars.githubusercontent.com/u/1668540?v=3","gravatar_id":"","url":"https://api.github.com/users/henrychoi","html_url":"https://github.com/henrychoi","followers_url":"https://api.github.com/users/henrychoi/followers","following_url":"https://api.github.com/users/henrychoi/following{/other_user}","gists_url":"https://api.github.com/users/henrychoi/gists{/gist_id}","starred_url":"https://api.github.com/users/henrychoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrychoi/subscriptions","organizations_url":"https://api.github.com/users/henrychoi/orgs","repos_url":"https://api.github.com/users/henrychoi/repos","events_url":"https://api.github.com/users/henrychoi/events{/privacy}","received_events_url":"https://api.github.com/users/henrychoi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-01-13T05:36:37Z","updated_at":"2016-01-18T05:50:15Z","closed_at":null,"body":"I believe clock_setup(void) has a bug.  A copy and paste of my git commit (not pushed to master):\r\n\r\n-       *RCC_CFGR &= ~RCC_CFGR_SW_MASK;\r\n+       *RCC_CFGR &= ~RCC_CFGR_SW_MASK;//Change system clock source and wait\r\n\r\nI also have a question on the use of the external SDRAM, which is enabled: where is the code that copies the kernel .text from flash to the SDRAM and zeros out the kernel .bss in the SDRAM before calling the kernel entry function (with 0x08004000 as the 2nd kernel argument to the kernel)? "},"comment":{"url":"https://api.github.com/repos/mcoquelin-stm32/afboot-stm32/issues/comments/172432242","html_url":"https://github.com/mcoquelin-stm32/afboot-stm32/issues/1#issuecomment-172432242","issue_url":"https://api.github.com/repos/mcoquelin-stm32/afboot-stm32/issues/1","id":172432242,"user":{"login":"henrychoi","id":1668540,"avatar_url":"https://avatars.githubusercontent.com/u/1668540?v=3","gravatar_id":"","url":"https://api.github.com/users/henrychoi","html_url":"https://github.com/henrychoi","followers_url":"https://api.github.com/users/henrychoi/followers","following_url":"https://api.github.com/users/henrychoi/following{/other_user}","gists_url":"https://api.github.com/users/henrychoi/gists{/gist_id}","starred_url":"https://api.github.com/users/henrychoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrychoi/subscriptions","organizations_url":"https://api.github.com/users/henrychoi/orgs","repos_url":"https://api.github.com/users/henrychoi/repos","events_url":"https://api.github.com/users/henrychoi/events{/privacy}","received_events_url":"https://api.github.com/users/henrychoi/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T05:50:15Z","updated_at":"2016-01-18T05:50:15Z","body":"After more debugging, I think lr = 0xfffffffd IS correct, since we DO want\nto run the init code in user \"space\" (just the stack pointer really).\nAfter the \"bx lr\", I confirmed that I land at pc = 0x90556040 (which is in\nthe SDRAM), which IS the address I modified (or'ing the 1 to the start\naddress) = 0x50556041.\n\nThe problem then appears to be that the busybox code is jumping to 0x0,\nbecause of the content of the busybox image in SDRAM.\n\nThe memory dump of this neck of the woods is:\n\n0x90556040 : 0x90556040 <Hex>\n  Address   0 - 3     4 - 7     8 - B     C - F\n  90556040  00000000  0448054B  1B1A062B  02D9044B\n  90556050  03B11847  704700BF  08010000  0B010000\n  90556060  00000000  05480649  091A8910  022391FB\n\nThere are 2 things I don't understand here:\n\n   1. The immediate problem seems to be that the content of 0x90556060 is\n   0x0, so the program is jumping off to the uC's ROM.\n   2. Why is the lr = 0?  Is that normal for a statically linked BFLT exe?\n   Am I missing some patch for the busybox?  I've never debugged an init\n   program--not to mention a BFLT binary.  Looks like yet another hill to\n   climb...\n\nBRm4/output/build/busybox-1.24.1$ file busybox\nbusybox: BFLT executable - version 4 gotpic\n\nI wonder if the copying of the initramfs from the init.data in flash to\nSDRAM is working correctly, or whether there is some kind of cacheing being\ndone inside the SDRAM chip?\n"}}