Ethernet for Nucleo and Disco board STM32F746 works with gcc and arm. IAC is untested

Dependents:   STM32F746_iothub_client_sample_mqtt DISCO-F746NG_Ethernet Nucleo_F746ZG_Ethernet thethingsiO-DISCO_F746NG-mqtt ... more

Committer:
DieterGraef
Date:
Thu Jun 23 09:04:23 2016 +0000
Revision:
1:28ba13dd96f7
Parent:
0:d26c1b55cfca
corrected MAC issue. The MAC is now 02:00:00:xx:xx:xx where xx is the sum over the unique device register

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:d26c1b55cfca 1 /* Copyright (C) 2013 - Adam Green (https://github.com/adamgreen)
DieterGraef 0:d26c1b55cfca 2
DieterGraef 0:d26c1b55cfca 3 Licensed under the Apache License, Version 2.0 (the "License");
DieterGraef 0:d26c1b55cfca 4 you may not use this file except in compliance with the License.
DieterGraef 0:d26c1b55cfca 5 You may obtain a copy of the License at
DieterGraef 0:d26c1b55cfca 6
DieterGraef 0:d26c1b55cfca 7 http://www.apache.org/licenses/LICENSE-2.0
DieterGraef 0:d26c1b55cfca 8
DieterGraef 0:d26c1b55cfca 9 Unless required by applicable law or agreed to in writing, software
DieterGraef 0:d26c1b55cfca 10 distributed under the License is distributed on an "AS IS" BASIS,
DieterGraef 0:d26c1b55cfca 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
DieterGraef 0:d26c1b55cfca 12 See the License for the specific language governing permissions and
DieterGraef 0:d26c1b55cfca 13 limitations under the License.
DieterGraef 0:d26c1b55cfca 14 */
DieterGraef 0:d26c1b55cfca 15 #if defined(TOOLCHAIN_GCC) && defined(__thumb2__)
DieterGraef 0:d26c1b55cfca 16
DieterGraef 0:d26c1b55cfca 17 #include <stdio.h>
DieterGraef 0:d26c1b55cfca 18
DieterGraef 0:d26c1b55cfca 19
DieterGraef 0:d26c1b55cfca 20 /* This is a hand written Thumb-2 assembly language version of the
DieterGraef 0:d26c1b55cfca 21 standard C memcpy() function that can be used by the lwIP networking
DieterGraef 0:d26c1b55cfca 22 stack to improve its performance. It copies 4 bytes at a time and
DieterGraef 0:d26c1b55cfca 23 unrolls the loop to perform 4 of these copies per loop iteration.
DieterGraef 0:d26c1b55cfca 24 */
DieterGraef 0:d26c1b55cfca 25 __attribute__((naked)) void thumb2_memcpy(void* pDest, const void* pSource, size_t length)
DieterGraef 0:d26c1b55cfca 26 {
DieterGraef 0:d26c1b55cfca 27 __asm (
DieterGraef 0:d26c1b55cfca 28 ".syntax unified\n"
DieterGraef 0:d26c1b55cfca 29 ".thumb\n"
DieterGraef 0:d26c1b55cfca 30
DieterGraef 0:d26c1b55cfca 31 // Copy 16 bytes at a time first.
DieterGraef 0:d26c1b55cfca 32 " lsrs r3, r2, #4\n"
DieterGraef 0:d26c1b55cfca 33 " beq.n 2$\n"
DieterGraef 0:d26c1b55cfca 34 "1$: ldr r12, [r1], #4\n"
DieterGraef 0:d26c1b55cfca 35 " str r12, [r0], #4\n"
DieterGraef 0:d26c1b55cfca 36 " ldr r12, [r1], #4\n"
DieterGraef 0:d26c1b55cfca 37 " str r12, [r0], #4\n"
DieterGraef 0:d26c1b55cfca 38 " ldr r12, [r1], #4\n"
DieterGraef 0:d26c1b55cfca 39 " str r12, [r0], #4\n"
DieterGraef 0:d26c1b55cfca 40 " ldr r12, [r1], #4\n"
DieterGraef 0:d26c1b55cfca 41 " str r12, [r0], #4\n"
DieterGraef 0:d26c1b55cfca 42 " subs r3, #1\n"
DieterGraef 0:d26c1b55cfca 43 " bne 1$\n"
DieterGraef 0:d26c1b55cfca 44
DieterGraef 0:d26c1b55cfca 45 // Copy byte by byte for what is left.
DieterGraef 0:d26c1b55cfca 46 "2$:\n"
DieterGraef 0:d26c1b55cfca 47 " ands r3, r2, #0xf\n"
DieterGraef 0:d26c1b55cfca 48 " beq.n 4$\n"
DieterGraef 0:d26c1b55cfca 49 "3$: ldrb r12, [r1], #1\n"
DieterGraef 0:d26c1b55cfca 50 " strb r12, [r0], #1\n"
DieterGraef 0:d26c1b55cfca 51 " subs r3, #1\n"
DieterGraef 0:d26c1b55cfca 52 " bne 3$\n"
DieterGraef 0:d26c1b55cfca 53
DieterGraef 0:d26c1b55cfca 54 // Return to caller.
DieterGraef 0:d26c1b55cfca 55 "4$: bx lr\n"
DieterGraef 0:d26c1b55cfca 56 );
DieterGraef 0:d26c1b55cfca 57 }
DieterGraef 0:d26c1b55cfca 58
DieterGraef 0:d26c1b55cfca 59 #endif