Received: from PCH.mit.edu (18.7.21.50) by mail.efplus.com (192.168.0.8) with Microsoft SMTP Server (TLS) id 8.3.485.1; Thu, 30 Jul 2020 10:31:56 -0700 Received: from PCH.MIT.EDU (localhost.localdomain [127.0.0.1]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 06UHOOxR020403; Thu, 30 Jul 2020 13:24:27 -0400 Received: from outgoing-exchange-5.mit.edu (OUTGOING-EXCHANGE-5.MIT.EDU [18.9.28.59]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 06UHOMn8020395 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 30 Jul 2020 13:24:23 -0400 Received: from w92exedge4.exchange.mit.edu (W92EXEDGE4.EXCHANGE.MIT.EDU [18.7.73.16]) by outgoing-exchange-5.mit.edu (8.14.7/8.12.4) with ESMTP id 06UHO7AG028304 for ; Thu, 30 Jul 2020 13:24:09 -0400 Received: from w92expo23.exchange.mit.edu (18.7.74.77) by w92exedge4.exchange.mit.edu (18.7.73.16) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Thu, 30 Jul 2020 13:23:39 -0400 Received: from oc11exhyb7.exchange.mit.edu (18.9.1.112) by w92expo23.exchange.mit.edu (18.7.74.77) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Thu, 30 Jul 2020 13:24:10 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.107) by oc11exhyb7.exchange.mit.edu (18.9.1.112) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Thu, 30 Jul 2020 13:24:10 -0400 Received: from MWHPR14CA0052.namprd14.prod.outlook.com (2603:10b6:300:81::14) by DM6PR01MB6010.prod.exchangelabs.com (2603:10b6:5:1dd::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.26; Thu, 30 Jul 2020 17:24:09 +0000 Received: from CO1NAM03FT045.eop-NAM03.prod.protection.outlook.com (2603:10b6:300:81:cafe::82) by MWHPR14CA0052.outlook.office365.com (2603:10b6:300:81::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16 via Frontend Transport; Thu, 30 Jul 2020 17:24:08 +0000 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (40.92.23.67) by CO1NAM03FT045.mail.protection.outlook.com (10.152.81.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.10 via Frontend Transport; Thu, 30 Jul 2020 17:24:08 +0000 Received: from MW2NAM12FT055.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::49) by MW2NAM12HT213.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::357) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.14; Thu, 30 Jul 2020 17:24:07 +0000 Received: from BYAPR02MB4055.namprd02.prod.outlook.com (2a01:111:e400:fc65::4e) by MW2NAM12FT055.mail.protection.outlook.com (2a01:111:e400:fc65::223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.14 via Frontend Transport; Thu, 30 Jul 2020 17:24:07 +0000 Received: from BYAPR02MB4055.namprd02.prod.outlook.com ([fe80::e04e:e8e2:57be:7927]) by BYAPR02MB4055.namprd02.prod.outlook.com ([fe80::e04e:e8e2:57be:7927%7]) with mapi id 15.20.3216.034; Thu, 30 Jul 2020 17:24:07 +0000 From: Bob Blick To: Microcontroller discussion list - Public. Sender: "piclist-bounces@mit.edu" Date: Thu, 30 Jul 2020 10:24:07 -0700 Subject: Re: [PIC] Simple GCC question Thread-Topic: [PIC] Simple GCC question Thread-Index: AQHWZotc+nNhZovUu0iBK4Bhj1/IWakgUpsAgAAC+G+AAAYQAIAAAoWV Message-ID: References: , <5F22FF16.9030607@narwani.org> List-Help: List-Subscribe: , List-Unsubscribe: , In-Reply-To: <5F22FF16.9030607@narwani.org> Reply-To: Microcontroller discussion list - Public. Accept-Language: en-US Content-Language: en-US X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-AuthSource: TS500.efplus4.local X-MS-Has-Attach: X-Auto-Response-Suppress: All X-MS-Exchange-Organization-SenderIdResult: TempError X-MS-Exchange-Organization-PRD: mit.edu X-MS-TNEF-Correlator: acceptlanguage: en-US received-spf: Pass (protection.outlook.com: domain of outlook.com designates 40.92.23.67 as permitted sender) receiver=protection.outlook.com; client-ip=40.92.23.67; helo=NAM12-MW2-obe.outbound.protection.outlook.com; dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lx+sfHPThXcAJ0kDmRvxZ10p5ztTohT9AgESYfdp5Q4=; b=ebsJU4lHVAbYsCb4FpkoMpZzAHndUVoLuCewEkWmIlJ4jOP5JylGYvi2HNf3clp2yQ1qIM6kA7hXYCVQ6FQ2RAiSZHrZqziy1sGDdCIWpb97qkAbNUFlfa8qKBKv+De9saFIGDkaLv2j1unNlOADC0R1Jl7h5YOhWxm7R4qliqC/0vpJ100Bh/NUt2amaZYNEcUdES7lbTVlO5gVAq9Af97mz8iv9o/zTuwGqcfAL9dVPOdaJtLs6tam9oh0+nycttzVsT82nX9i3/pp8HWkN5XGCWQP/rvZr61xU73TKCrtU5wqRyjNwwoA0ixf8oCZn//h8+llYtDgN2I0GdV/XQ== authentication-results: spf=pass (sender IP is 40.92.23.67) smtp.mailfrom=outlook.com; mit.edu; dkim=pass (signature was verified) header.d=outlook.com; mit.edu; dmarc=pass action=none header.from=outlook.com; errors-to: piclist-bounces@mit.edu list-id: "Microcontroller discussion list - Public." list-post: x-beenthere: piclist@mit.edu x-mailman-version: 2.1.6 x-topics: [PIC] x-mime-autoconverted: from quoted-printable to 8bit by PCH.mit.edu id 06UHOMn8020395 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Hi Neil, The ports and pins are in main.h Individually they are constants, but GCC doesn't like using arrays of them = handed to Lcd_create, it no longer considers them constants. I think. Thanks, Bob ________________________________________ From: piclist-bounces@mit.edu on behalf of Neil=20 Sent: Thursday, July 30, 2020 10:10 AM To: Microcontroller discussion list - Public. Subject: Re: [PIC] Simple GCC question Bob, Strange way to do this IMO... I would keep ports & pins together in a struct for each GPIO, then group those together for your call to lcd_create(). Either way, I'm not sure why gcc thinks your port and pin definitions aren't constants. Aren't you using CMSIS for those definitions? In HAL (which ultimately uses CMSIS), ports and pins are defined in the mail header file like this... #define LED_Pin GPIO_PIN_13 #define LED_GPIO_Port GPIOC Then these are further defined in a deeper file as: #define GPIO_PIN_13 ((uint16_t)0x2000) /* Pin 13 selected */ and... #define GPIOC ((GPIO_TypeDef *)GPIOC_BASE) and then... #define GPIOC_BASE (APB2PERIPH_BASE + 0x00001000UL) and also... /*!< Peripheral memory map */ #define APB1PERIPH_BASE PERIPH_BASE #define APB2PERIPH_BASE (PERIPH_BASE + 0x00010000UL) #define AHBPERIPH_BASE (PERIPH_BASE + 0x00020000UL) ....which are constants. How/where do you have your ports and pins defined? Cheers, -Neil. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .