{"action":"created","issue":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2637","repository_url":"https://api.github.com/repos/ARMmbed/mbed-os","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2637/labels{/name}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2637/comments","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2637/events","html_url":"https://github.com/ARMmbed/mbed-os/issues/2637","id":175467830,"number":2637,"title":"Multiple CRC Issues (multiple code copies, crc.h #define CRC16 means CRC32/CRC_CCITT functionality cannot be used, etc)","user":{"login":"simonqhughes","id":10880926,"avatar_url":"https://avatars.githubusercontent.com/u/10880926?v=3","gravatar_id":"","url":"https://api.github.com/users/simonqhughes","html_url":"https://github.com/simonqhughes","followers_url":"https://api.github.com/users/simonqhughes/followers","following_url":"https://api.github.com/users/simonqhughes/following{/other_user}","gists_url":"https://api.github.com/users/simonqhughes/gists{/gist_id}","starred_url":"https://api.github.com/users/simonqhughes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonqhughes/subscriptions","organizations_url":"https://api.github.com/users/simonqhughes/orgs","repos_url":"https://api.github.com/users/simonqhughes/repos","events_url":"https://api.github.com/users/simonqhughes/events{/privacy}","received_events_url":"https://api.github.com/users/simonqhughes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-07T10:28:25Z","updated_at":"2016-09-12T15:27:30Z","closed_at":null,"body":"There are multiple issues with the CRC code available in mbedos as described in the following:\r\n\r\n#### Issue 1: Multiple copies of crc.[ch] present in the tree, in the wrong locations\r\n\r\nThe crc.h/c platform independent code appears in platform dependent target subdirs e.g.:\r\n```\r\nmbed-os/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K66F/TARGET_FRDM/crc.c\r\nmbed-os/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K66F/TARGET_FRDM/crc.h\r\nmbed-os/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_MCU_K64F/TARGET_FRDM/crc.c\r\nmbed-os/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_MCU_K64F/TARGET_FRDM/crc.h\r\n```\r\n\r\nThe issues are:\r\n- The code should be located in a platform independent location e.g. hal/common.\r\n- There should only be 1 version of the code common to all platforms.\r\n\r\n#### Issue 2: crc.h #define CRC16 means CRC32/CRC_CCITT functionality cannot be used\r\n\r\nThe following lines of code is present in crc.h:\r\n```\r\n/*\r\n * Select the CRC standard from the list that follows.\r\n */\r\n#define CRC16\r\n```\r\n\r\nThis means:\r\n- the CRC32 and CRC_CCITT implementations cannot be used\r\n- a command line -DCRC32 or -DCRC_CCITT does not override the default CRC16 behaviour\r\n\r\n#### Issue 3: crc.h Interface does not allow clients to use CRC16 and CRC32 functionality within the same build.\r\n- Currently, K64F mbed_overrides.c::mbed_mac_address() uses crcSlow() to compute a hash for generating mac addresses. \r\n- all application code must use CRC16. e.g. the flash journal implementation on K64F requires a CRC32 implementation but crc.h/c is built for CRC16 for mbed_overrides.c::mbed_mac_address(), hence leading to duplicate code (flash journal will implement a crc32 implementation).\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/comments/246385277","html_url":"https://github.com/ARMmbed/mbed-os/issues/2637#issuecomment-246385277","issue_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2637","id":246385277,"user":{"login":"sg-","id":496002,"avatar_url":"https://avatars.githubusercontent.com/u/496002?v=3","gravatar_id":"","url":"https://api.github.com/users/sg-","html_url":"https://github.com/sg-","followers_url":"https://api.github.com/users/sg-/followers","following_url":"https://api.github.com/users/sg-/following{/other_user}","gists_url":"https://api.github.com/users/sg-/gists{/gist_id}","starred_url":"https://api.github.com/users/sg-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sg-/subscriptions","organizations_url":"https://api.github.com/users/sg-/orgs","repos_url":"https://api.github.com/users/sg-/repos","events_url":"https://api.github.com/users/sg-/events{/privacy}","received_events_url":"https://api.github.com/users/sg-/received_events","type":"User","site_admin":false},"created_at":"2016-09-12T15:27:30Z","updated_at":"2016-09-12T15:27:30Z","body":"Issue 1 - This should be common, good call\r\nIssue 2 - The code needs to be updated to support all 3 modes at runtime\r\nIssue 3 - I think will be fixed by Issue 2\r\n\r\nIt would be best to not introduce a public crc routine if possible rather use one of these once moved. "}}
{"actor":{"display_login":"sg-"}}