Skip to content

Instantly share code, notes, and snippets.

@fanoush
Last active November 13, 2020 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanoush/7553104fa7c8c596fe91f276d3f297fd to your computer and use it in GitHub Desktop.
Save fanoush/7553104fa7c8c596fe91f276d3f297fd to your computer and use it in GitHub Desktop.

Revisions

  1. fanoush revised this gist Nov 13, 2020. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions WeActF411.py
    @@ -39,7 +39,7 @@
    'NEOPIXEL'
    ],
    'makefile' : [
    'DEFINES+=-DUSE_USB_OTG_FS=1 -DUSB_NO_VBUS_SENSE',
    'DEFINES+=-DUSE_USB_OTG_FS=1 -DUSB_NO_VBUS_SENSE -DSWD_ONLY_NO_JTAG',
    'DEFINES+=-DPIN_NAMES_DIRECT=1 -DUSE_RTC=1 -DHSE_VALUE="((uint32_t)25000000)"',
    'STLIB=STM32F411xE',
    'PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f401xx.o'
    @@ -81,12 +81,12 @@
    },
    'BTN1' : { 'pin' : 'A0',
    # 'inverted' : True, # 1 when unpressed, 0 when pressed! (Espruino board is 1 when pressed)
    'pinstate': 'IN_PULLUP', # to specify INPUT, OUPUT PULL_UP PULL_DOWN..
    'pinstate': 'IN_PULLUP', # to specify INPUT, OUPUT PULL_UP PULL_DOWN.. 'pinstate' : 'IN_PULLDOWN'
    },
    'JTAG' : {
    # 'pin_MS' : 'A13',
    'pin_MS' : 'A13',
    'pin_CK' : 'A14',
    'pin_DI' : 'A15'
    # 'pin_DI' : 'A15'
    },
    'USB' : {
    # 'pin_otg_pwr' : 'C0',
    @@ -108,5 +108,4 @@ def get_pins():
    pins = pinutils.scan_pin_af_file(pins, 'stm32f401_af.csv', 0, 1)
    pinutils.findpin(pins, "PC13", True)["functions"]["NEGATED"]=0
    pinutils.findpin(pins, "PA0", True)["functions"]["NEGATED"]=0
    return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

    return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
  2. fanoush revised this gist Nov 12, 2020. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions WeActF411.py
    @@ -77,10 +77,10 @@
    'OSC_RTC' : { 'pin_1' : 'C14', # MB1136 C-02 corresponds to a board configured with on-board 32kHz oscillator
    'pin_2' : 'C15' },
    'LED1' : { 'pin' : 'C13',
    'inverted' : True,
    # 'inverted' : True,
    },
    'BTN1' : { 'pin' : 'A0',
    'inverted' : True, # 1 when unpressed, 0 when pressed! (Espruino board is 1 when pressed)
    # 'inverted' : True, # 1 when unpressed, 0 when pressed! (Espruino board is 1 when pressed)
    'pinstate': 'IN_PULLUP', # to specify INPUT, OUPUT PULL_UP PULL_DOWN..
    },
    'JTAG' : {
    @@ -106,4 +106,7 @@
    def get_pins():
    pins = pinutils.scan_pin_file([], 'stm32f401.csv', 5, 8, 9)
    pins = pinutils.scan_pin_af_file(pins, 'stm32f401_af.csv', 0, 1)
    return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
    pinutils.findpin(pins, "PC13", True)["functions"]["NEGATED"]=0
    pinutils.findpin(pins, "PA0", True)["functions"]["NEGATED"]=0
    return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])

  3. fanoush revised this gist Oct 20, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions WeActF411.py
    @@ -84,9 +84,9 @@
    'pinstate': 'IN_PULLUP', # to specify INPUT, OUPUT PULL_UP PULL_DOWN..
    },
    'JTAG' : {
    'pin_MS' : 'A13',
    # 'pin_MS' : 'A13',
    'pin_CK' : 'A14',
    # 'pin_DI' : 'A15'
    'pin_DI' : 'A15'
    },
    'USB' : {
    # 'pin_otg_pwr' : 'C0',
  4. fanoush created this gist Oct 18, 2020.
    109 changes: 109 additions & 0 deletions WeActF411.py
    @@ -0,0 +1,109 @@
    #!/bin/false
    # -*- coding: utf8 -*-
    # This file is part of Espruino, a JavaScript interpreter for Microcontrollers
    #
    # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
    #
    # This Source Code Form is subject to the terms of the Mozilla Public
    # License, v. 2.0. If a copy of the MPL was not distributed with this
    # file, You can obtain one at http://mozilla.org/MPL/2.0/.
    #
    # ----------------------------------------------------------------------------------------
    # This file contains information for a specific board - the available pins, and where LEDs,
    # Buttons, and other in-built peripherals are. It is used to build documentation as well
    # as various source and header files for Espruino.
    # ----------------------------------------------------------------------------------------

    import pinutils;
    info = {
    'name' : "WeAct F411CEU6",
    'link' : [ "https://github.com/WeActTC/MiniF4-STM32F4x1"],
    'default_console' : "EV_SERIAL2", # USART2 by default
    'default_console_tx' : "A2", # USART2_TX on PA2,
    'default_console_rx' : "A3", # USART2_RX on PA3
    # 'default_console' : "EV_SERIAL1",
    # 'default_console_tx' : "B6",
    # 'default_console_rx' : "B7",
    'default_console_baudrate' : "9600",
    'variables' : 7148, #7423 (128-12)*1024/16-1
    'binary_name' : 'espruino_%v_weactf411.bin',
    'build' : {
    'optimizeflags' : '-Os',
    'libraries' : [
    'USB_HID',
    'NET',
    'GRAPHICS',
    'FILESYSTEM',
    'CRYPTO','SHA256','SHA512',
    'TLS',
    'NEOPIXEL'
    ],
    'makefile' : [
    'DEFINES+=-DUSE_USB_OTG_FS=1 -DUSB_NO_VBUS_SENSE',
    'DEFINES+=-DPIN_NAMES_DIRECT=1 -DUSE_RTC=1 -DHSE_VALUE="((uint32_t)25000000)"',
    'STLIB=STM32F411xE',
    'PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f401xx.o'
    ]
    }
    };
    chip = {
    'part' : "STM32F411CEU6",
    'family' : "STM32F4",
    'package' : "UQFN48",
    'ram' : 128, # 0x0001 8000 long, from 0x2000 0000 to 0x2001 7FFF
    'flash' : 512, # 0x0008 0000 long, from 0x0800 0000 to 0x0807 FFFF
    'speed' : 96,
    'usart' : 6,
    'spi' : 4,
    'i2c' : 3,
    'adc' : 1,
    'dac' : 0,
    'saved_code' : {
    # code size 225248 = 0x36FE0 starts at 0x0800 0000 ends at 0x0803 6FE0
    # so we have some left room for Espruino firmware and no risk to clear it while saving
    'address' : 0x08060000, # flash_saved_code_start 0x0806 0000 to 0x807 5000
    # we have enough flash space in this single flash page to save all of the ram
    'page_size' : 131072, # size of pages : on STM32F411, last 2 pages are 128 Kbytes
    # we use the last flash page only, furthermore it persists after a firmware flash of the board
    'pages' : 1, # count of pages we're using to save RAM to Flash,
    'flash_available' : 384 # we use the last 128k page
    },
    #'place_text_section' : 0x08010000, # note flash_available above # TODO USELESS
    };

    devices = {
    'OSC' : { 'pin_1' : 'H0', # MCO from ST-LINK fixed at 8 Mhz, boards rev MB1136 C-02
    'pin_2' : 'H1' },
    'OSC_RTC' : { 'pin_1' : 'C14', # MB1136 C-02 corresponds to a board configured with on-board 32kHz oscillator
    'pin_2' : 'C15' },
    'LED1' : { 'pin' : 'C13',
    'inverted' : True,
    },
    'BTN1' : { 'pin' : 'A0',
    'inverted' : True, # 1 when unpressed, 0 when pressed! (Espruino board is 1 when pressed)
    'pinstate': 'IN_PULLUP', # to specify INPUT, OUPUT PULL_UP PULL_DOWN..
    },
    'JTAG' : {
    'pin_MS' : 'A13',
    'pin_CK' : 'A14',
    # 'pin_DI' : 'A15'
    },
    'USB' : {
    # 'pin_otg_pwr' : 'C0',
    'pin_dm' : 'A11',
    'pin_dp' : 'A12',
    # 'pin_vbus' : 'A9',
    # 'pin_id' : 'A10',
    },
    };

    # left-right, or top-bottom order
    board = {
    };
    board["_css"] = """
    """;

    def get_pins():
    pins = pinutils.scan_pin_file([], 'stm32f401.csv', 5, 8, 9)
    pins = pinutils.scan_pin_af_file(pins, 'stm32f401_af.csv', 0, 1)
    return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])