{"action":"created","issue":{"url":"https://api.github.com/repos/atmelcorp/atmel-software-package/issues/6","repository_url":"https://api.github.com/repos/atmelcorp/atmel-software-package","labels_url":"https://api.github.com/repos/atmelcorp/atmel-software-package/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/atmelcorp/atmel-software-package/issues/6/comments","events_url":"https://api.github.com/repos/atmelcorp/atmel-software-package/issues/6/events","html_url":"https://github.com/atmelcorp/atmel-software-package/issues/6","id":174186185,"number":6,"title":"SAMA5D2 nandflash problems with sam-ba 3.1.3","user":{"login":"sepldj","id":21354124,"avatar_url":"https://avatars.githubusercontent.com/u/21354124?v=3","gravatar_id":"","url":"https://api.github.com/users/sepldj","html_url":"https://github.com/sepldj","followers_url":"https://api.github.com/users/sepldj/followers","following_url":"https://api.github.com/users/sepldj/following{/other_user}","gists_url":"https://api.github.com/users/sepldj/gists{/gist_id}","starred_url":"https://api.github.com/users/sepldj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sepldj/subscriptions","organizations_url":"https://api.github.com/users/sepldj/orgs","repos_url":"https://api.github.com/users/sepldj/repos","events_url":"https://api.github.com/users/sepldj/events{/privacy}","received_events_url":"https://api.github.com/users/sepldj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-31T05:16:06Z","updated_at":"2016-08-31T06:02:03Z","closed_at":null,"body":"Reproducing question posted to at91sam forum:\r\n\r\n> I'm facing some issues working with the nandflash applet provided with sam-ba version 3.1.3. I'm using the examples/sama5d2/nandflash/nandflash-usb.qml script.\r\n> \r\n> When invoked, the applet fails with the following error:\r\n> \r\n> Applet.qml:95: Error: Could not initialize applet (status: undefined)\r\n> \r\n> To investigate the issue further, I started hacking into the applet source (https://github.com/atmelcorp/atmel-soft ... ash/main.c):\r\n> \r\n> I don't have any jtag interfaces at my disposal, so the debugging is quite slow and painful, however what I find is, the issue appears to be related to some sort of RAM/stack corruption.\r\n> \r\n> The reason for the above error is, the applet crashes during initialisation in handle_cmd_initialize() - code never returns from applet_set_init_params().\r\n> \r\n> One of the debug steps is, I've stubbed out the following functions to return success.\r\n> \r\n> ```\r\n> handle_cmd_read_info()\r\n> handle_cmd_erase_pages()\r\n> handle_cmd_read_pages()\r\n> handle_cmd_write_pages()\r\n> ```\r\n> \r\n> At this point the initialisation completes successfully (see output snippet below):\r\n> \r\n> ```\r\n> Opening serial port 'COM6'\r\n> Connection opened.\r\n> XXXXXXXXXXXX\r\n> args: 0,5,2,8,0\r\n> Detected memory size is 536870912 bytes.\r\n> XXXXXXXXXXXX\r\n> Erased 0 bytes at address 0x00000000 (0.00%)\r\n> Erased 0 bytes at address 0x00000000 (0.00%)\r\n> Erased 0 bytes at address 0x00000000 (0.00%)\r\n> Erased 0 bytes at address 0x00000000 (0.00%)\r\n> Erased 0 bytes at address 0x00000000 (0.00%)\r\n> ...```\r\n\r\nI've since got the HW guys to connect the jtag port and got the IAR debugger going. This leads me to the next question:\r\n\r\nIf I download the applet via IAR - jtag, I get the debugger, but I don't appear to have the environment setup by SAM-BA (the applet executes and returns to la-la land - presumably because the applet wasn't invoked by the bootROM loader?).\r\n\r\nIf I use SAM-BA to download the applet, I loose the ability to debug it.\r\n\r\nSo the question is, what's the best way to get the best of both worlds? I'd like to be able to invoke the applet from the SAM-BA command line application, but still have the ability to debug it.\r\n\r\nThanks in advance."},"comment":{"url":"https://api.github.com/repos/atmelcorp/atmel-software-package/issues/comments/243666774","html_url":"https://github.com/atmelcorp/atmel-software-package/issues/6#issuecomment-243666774","issue_url":"https://api.github.com/repos/atmelcorp/atmel-software-package/issues/6","id":243666774,"user":{"login":"loiclefort","id":6547274,"avatar_url":"https://avatars.githubusercontent.com/u/6547274?v=3","gravatar_id":"","url":"https://api.github.com/users/loiclefort","html_url":"https://github.com/loiclefort","followers_url":"https://api.github.com/users/loiclefort/followers","following_url":"https://api.github.com/users/loiclefort/following{/other_user}","gists_url":"https://api.github.com/users/loiclefort/gists{/gist_id}","starred_url":"https://api.github.com/users/loiclefort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loiclefort/subscriptions","organizations_url":"https://api.github.com/users/loiclefort/orgs","repos_url":"https://api.github.com/users/loiclefort/repos","events_url":"https://api.github.com/users/loiclefort/events{/privacy}","received_events_url":"https://api.github.com/users/loiclefort/received_events","type":"User","site_admin":false},"created_at":"2016-08-31T06:02:03Z","updated_at":"2016-08-31T06:02:03Z","body":"Debugging the applets using IAR is not yet implemented, only GDB is supported:\r\n\r\n    cd samba_applets/nandflash\r\n    make TARGET=sama5d2-generic debug\r\n\r\nThe GDB script provided contains a \"runapplet\" macro:\r\n\r\n    runapplet 0 0 5 2 8 0\r\n\r\nYou can also get some information on the device console. Applets will display some status on the UART configured in the boot configuration.\r\n\r\nCan you provide your NAND model? The cause of the issue could be that the memory is not ONFI compliant. We don't yet support non-ONFI NANDs."}}
{"actor":{"display_login":"loiclefort"}}