{"action":"created","issue":{"url":"https://api.github.com/repos/platformio/platformio/issues/474","labels_url":"https://api.github.com/repos/platformio/platformio/issues/474/labels{/name}","comments_url":"https://api.github.com/repos/platformio/platformio/issues/474/comments","events_url":"https://api.github.com/repos/platformio/platformio/issues/474/events","html_url":"https://github.com/platformio/platformio/issues/474","id":128774006,"number":474,"title":"Custom board with linker script","user":{"login":"zserge","id":1911760,"avatar_url":"https://avatars.githubusercontent.com/u/1911760?v=3","gravatar_id":"","url":"https://api.github.com/users/zserge","html_url":"https://github.com/zserge","followers_url":"https://api.github.com/users/zserge/followers","following_url":"https://api.github.com/users/zserge/following{/other_user}","gists_url":"https://api.github.com/users/zserge/gists{/gist_id}","starred_url":"https://api.github.com/users/zserge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zserge/subscriptions","organizations_url":"https://api.github.com/users/zserge/orgs","repos_url":"https://api.github.com/users/zserge/repos","events_url":"https://api.github.com/users/zserge/events{/privacy}","received_events_url":"https://api.github.com/users/zserge/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/platformio/platformio/labels/help%20wanted","name":"help wanted","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"ivankravets","id":1760209,"avatar_url":"https://avatars.githubusercontent.com/u/1760209?v=3","gravatar_id":"","url":"https://api.github.com/users/ivankravets","html_url":"https://github.com/ivankravets","followers_url":"https://api.github.com/users/ivankravets/followers","following_url":"https://api.github.com/users/ivankravets/following{/other_user}","gists_url":"https://api.github.com/users/ivankravets/gists{/gist_id}","starred_url":"https://api.github.com/users/ivankravets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivankravets/subscriptions","organizations_url":"https://api.github.com/users/ivankravets/orgs","repos_url":"https://api.github.com/users/ivankravets/repos","events_url":"https://api.github.com/users/ivankravets/events{/privacy}","received_events_url":"https://api.github.com/users/ivankravets/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2016-01-26T09:44:28Z","updated_at":"2016-01-26T11:24:58Z","closed_at":null,"body":"I'm trying to use platformio with custom boards (specifically, stm32f401rb).\r\n\r\nI've created a JSON file describing my board like this:\r\n\r\n```json\r\n{\r\n        \"my_stm32f401\": {\r\n                \"build\": {\r\n                        \"core\": \"stm32\",\r\n                        \"extra_flags\": \"-DSTM32F4 -DSTM32F401xB -DSTM32F40_41xxx\",\r\n                        \"f_cpu\": \"8000000L\",\r\n                        \"ldscript\": \"stm32f401.ld\",\r\n                        \"cpu\": \"cortex-m4\",\r\n                        \"mcu\": \"stm32f401rbt6\",\r\n                        \"variant\": \"stm32f401rb\"\r\n                },\r\n                \"frameworks\": [\"mbed\", \"cmsis\", \"spl\", \"libopencm3\"],\r\n                \"name\": \"My STM32F401 Board\",\r\n                \"platform\": \"ststm32\",\r\n                \"upload\": {\r\n                        \"maximum_ram_size\": 65536,\r\n                        \"maximum_size\": 131072\r\n                },\r\n                \"url\": \"http://example.com\",\r\n                \"vendor\": \"Myself\"\r\n        }\r\n}\r\n```\r\n\r\nI use libopencm3 framework, it contains a \"common\" stm32f4 linker script which is supposed to be included like this (this is my `stm32f401.ld` from the config above):\r\n\r\n```json\r\nMEMORY\r\n{\r\n\trom (rx) : ORIGIN = 0x08000000, LENGTH = 128K\r\n\tram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K\r\n}\r\n\r\nINCLUDE libopencm32_stm32f4.ld\r\n```\r\n\r\nSo the question is - where should I put my custom ldscript for my custom board? I would prefer it to be next to my sources, in my project directory.\r\n\r\nCurrently the only working location was `~/.platformio/packages/frameworks/libopencm3/lib/stm32/f4/`. Neither project root, nor `src` directory worked and printed the following error:\r\n\r\n```\r\nTypeError: coercing to Unicode: need string or buffer, NoneType found:\r\nFile \"/usr/local/lib/python2.7/dist-packages/platformio/builder/main.py\", line 141:\r\nenv.SConscript(\"$BUILD_SCRIPT\")\r\nFile \"/home/serge/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py\", line 551:\r\nreturn _SConscript(self.fs, *files, **subst_kw)\r\nFile \"/home/serge/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py\", line 260:\r\nexec _file_ in call_stack[-1].globals\r\nFile \"/usr/local/lib/python2.7/dist-packages/platformio/builder/scripts/ststm32.py\", line 81:\r\ntarget_elf = env.BuildProgram()\r\nFile \"/home/serge/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py\", line 224:\r\nreturn self.method(*nargs, **kwargs)\r\nFile \"/usr/local/lib/python2.7/dist-packages/platformio/builder/tools/platformio.py\", line 50:\r\nf.lower().strip() for f in env.get(\"FRAMEWORK\", \"\").split(\",\")])\r\nFile \"/home/serge/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py\", line 224:\r\nreturn self.method(*nargs, **kwargs)\r\nFile \"/usr/local/lib/python2.7/dist-packages/platformio/builder/tools/platformio.py\", line 192:\r\njoin(\"$PIOBUILDER_DIR\", \"scripts\", \"frameworks\", \"%s.py\" % f)))\r\nFile \"/home/serge/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py\", line 614:\r\nreturn method(*args, **kw)\r\nFile \"/home/serge/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py\", line 551:\r\nreturn _SConscript(self.fs, *files, **subst_kw)\r\nFile \"/home/serge/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py\", line 260:\r\nexec _file_ in call_stack[-1].globals\r\nFile \"/usr/local/lib/python2.7/dist-packages/platformio/builder/scripts/frameworks/libopencm3.py\", line 171:\r\nldscript_path = find_ldscript(root_dir)\r\nFile \"/usr/local/lib/python2.7/dist-packages/platformio/builder/scripts/frameworks/libopencm3.py\", line 59:\r\nassert isfile(ldscript)\r\nFile \"/usr/lib/python2.7/genericpath.py\", line 29:\r\nst = os.stat(path)\r\n```\r\n\r\nAnd in fact during the first build my linker script in opencm3 source tree has been expanded and my include statement has been replaced by full contents of the `libopencm32_stm32f4.ld`.\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/30214637-custom-board-with-linker-script?utm_campaign=plugin&utm_content=tracker%2F2014790&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F2014790&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/platformio/platformio/issues/comments/174962852","html_url":"https://github.com/platformio/platformio/issues/474#issuecomment-174962852","issue_url":"https://api.github.com/repos/platformio/platformio/issues/474","id":174962852,"user":{"login":"zserge","id":1911760,"avatar_url":"https://avatars.githubusercontent.com/u/1911760?v=3","gravatar_id":"","url":"https://api.github.com/users/zserge","html_url":"https://github.com/zserge","followers_url":"https://api.github.com/users/zserge/followers","following_url":"https://api.github.com/users/zserge/following{/other_user}","gists_url":"https://api.github.com/users/zserge/gists{/gist_id}","starred_url":"https://api.github.com/users/zserge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zserge/subscriptions","organizations_url":"https://api.github.com/users/zserge/orgs","repos_url":"https://api.github.com/users/zserge/repos","events_url":"https://api.github.com/users/zserge/events{/privacy}","received_events_url":"https://api.github.com/users/zserge/received_events","type":"User","site_admin":false},"created_at":"2016-01-26T11:24:58Z","updated_at":"2016-01-26T11:24:58Z","body":"Ok, extra_script can become a solution, but it looks like my extra script\nis evaluated after libopencm3.py fails at find_ldscript(path).. So I get a\ncrash before I'm able to \"patch\" my environment.\n\nOn Tue, Jan 26, 2016 at 6:37 PM, Ivan Kravets <notifications@github.com>\nwrote:\n\n> Also, don't forget that you can change build environment on-the-fly using\n> extra_script, including pre-defined board settings. See BOARD_OPTIONS\n> environment variable.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/platformio/platformio/issues/474#issuecomment-174949886>\n> .\n>\n\n\n\n-- \n\"One must have a chaos inside oneself to give birth to a dancing star.\" -\nThus Spoke Zarathustra\n"}}