Specifying f_cpu in boardname.json doesn't like L suffix

When I suffix the f_cpu frequency value with L within boardname.json then some boards give an error while others do not, and even for exactly the same frequency value! Can someone please explain the correct usage of the L “long” suffix? I’m not good enough with Python to know what is intended by reading the code.

For example “f_cpu”: “11059200L”, will yield an error like this with some boards but if I take out the L then everything is okay:

Building in release mode

ValueError: invalid literal for int() with base 10: '11059200L':

File \"C:\\Users\\user\\.platformio\\penv\\Lib\\site-packages\\platformio\\builder\\main.py\", line 177:

env.SConscript(\"$BUILD_SCRIPT\")

File \"C:\\Users\\user\\.platformio\\packages\\tool-scons\\scons-local-4.1.0\\SCons\\Script\\SConscript.py\", line 591:\r\n return _SConscript(self.fs, *files, **subst_kw)

File \"C:\\Users\\user\\.platformio\\packages\\tool-scons\\scons-local-4.1.0\\SCons\\Script\\SConscript.py\", line 280:\r\n exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)

File \"C:\\Users\\user\\.platformio\\platforms\\intel_mcs51\\builder\\main.py\", line 146:

f_cpu_khz = int(board_config.get(\"build.f_cpu\")) / 1000

Indeed, because of that line, the value in build.f_cpu has to be parsable as an integer with the Python int() functiont, so it can not contain any L.

That’s different to e.g. the atmel-avr platform which does not attempt to load the integer value into Python, but simply passes the value on.

Leaving out the L suffix will make the Python code not fail, but maybe the macro expansion

will be wrong then. Something like

long f_cpu = F_CPU; 

might internally overflow, because the F_CPU value is not a long constant…

You should open a bug report about this in Issues · platformio/platform-intel_mcs51 · GitHub.

I will open the bug, thanks. In the meantime everything seems to compile file without the L since clock frequency for MCS51 variants does not overflow an int.